From: David Lawrence Ramsey Date: Thu, 14 Dec 2006 20:03:30 +0000 (+0000) Subject: in do_writeout(), fix a segfault when we can't get the full path of X-Git-Tag: v2.0.2~8 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=4c19415ecfd8448ea40e24eefa7eeef4e5bea065;p=nano.git in do_writeout(), fix a segfault when we can't get the full path of either the filename we want to save under or the original filename git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3997 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 93de95a7..4642beb2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,10 @@ CVS code - nulls. (DLR) write_file() - Properly handle filenames that contain nulls. (DLR) + do_writeout() + - Fix a segfault when we can't get the full path of either the + filename we want to save under or the original filename. (DLR, + found by Mike Frysinger) - nano.h: - Rename NANO_ALT_REPLACE_KEY to NANO_REPLACE_ALTKEY, for consistency. (DLR) diff --git a/src/files.c b/src/files.c index 10e069eb..b83e6596 100644 --- a/src/files.c +++ b/src/files.c @@ -1897,7 +1897,8 @@ int do_writeout(bool exiting) unsunder(answer, answer_len); full_filename = get_full_path(openfile->filename); - different_name = (strcmp(full_answer, + different_name = (full_answer != NULL && + full_filename != NULL && strcmp(full_answer, full_filename) != 0); free(full_filename);