commit 8091d334a33faf98954a7240adf4bd1810383a4e
parent 9df069cc5f8597147fc25dcf05d725b876035a17
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 16 Nov 2004 02:23:10 +0000
add Ulf Harnhammar's input_tab() segfault fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2101 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
@@ -173,6 +173,9 @@ CVS code -
open_prevfile(), open_nextfile()
- Translate the "New Buffer" string when displaying "Switched
to" messages on the statusbar. (DLR)
+ input_tab()
+ - Fix snprintf() call so that we don't segfault when trying to
+ complete a filename containing %'s. (Ulf Harnhammar)
- global.c:
shortcut_init()
- Remove redundant NANO_SMALL #ifdef. (DLR)
diff --git a/src/files.c b/src/files.c
@@ -2406,7 +2406,7 @@ char *input_tab(char *buf, int place, bool *lastwastab, int *newplace,
/* make each filename shown be the same length as the
longest filename, with two spaces at the end */
- snprintf(foo, longestname + 1, matches[i]);
+ snprintf(foo, longestname + 1, "%s", matches[i]);
while (strlen(foo) < longestname)
strcat(foo, " ");