diff --git a/ChangeLog b/ChangeLog
index 4bd7e0c245a4bc8a6f60d9cab70029170c9eeb08..623f9fc9573c08e28ccbf7450df945c0996cda4f 100644
--- 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
index 4c82c952add1372a8230749d0e069650280d6df5..ed37ac3c3cb26fc817c3cefe38f40add6bd0810d 100644
--- 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, " ");