diff --git a/ChangeLog b/ChangeLog index af7ec042c9c28641cc95b22581693fd2d36a272f..31a363e84625785d237052e60322d774b9ae2bdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,7 @@ General - Added space and - keys to do page up and down. cwd_tab_completion(), input_tab() - Changed bare malloc/calloc calls to nmalloc (found by Rocco). + - Added null end of tmpBuf for sanity (Rocco). - nano.c: ABCD() - New function, figures out what kbinput to return given diff --git a/files.c b/files.c index ebb0acdaf56688fa8a5ac67bc9aac994a37e2db6..8248f498c134cb69feac7cea9dec66e77c9e1f7e 100644 --- a/files.c +++ b/files.c @@ -885,6 +885,7 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace) matchBuf = (char *) nmalloc((strlen(buf) + 2) * sizeof(char)); strncpy(matchBuf, buf, place); + matchBuf[place] = (char) NULL; tmp = matchBuf; /* skip any leading white space */