input_tab(): Added memset() to matchBuf to ensure sanity (Rocco, Adam).

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@484 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2001-01-16 04:45:38 +00:00
parent 51dd32fb4e
commit 4058709e0b
2 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ General
- Added space and - keys to do page up and down. - Added space and - keys to do page up and down.
cwd_tab_completion(), input_tab() cwd_tab_completion(), input_tab()
- Changed bare malloc/calloc calls to nmalloc (found by Rocco). - Changed bare malloc/calloc calls to nmalloc (found by Rocco).
- Added zero end of tmpBuf for sanity (Rocco). - Added memset() to matchBuf to ensure sanity (Rocco, Adam).
- nano.c: - nano.c:
ABCD() ABCD()
- New function, figures out what kbinput to return given - New function, figures out what kbinput to return given

View File

@ -883,9 +883,9 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
/* Make a local copy of the string -- up to the position of the /* Make a local copy of the string -- up to the position of the
cursor */ cursor */
matchBuf = (char *) nmalloc((strlen(buf) + 2) * sizeof(char)); matchBuf = (char *) nmalloc((strlen(buf) + 2) * sizeof(char));
memset(matchBuf, '\0', (strlen(buf) + 2));
strncpy(matchBuf, buf, place); strncpy(matchBuf, buf, place);
matchBuf[place] = 0;
tmp = matchBuf; tmp = matchBuf;
/* skip any leading white space */ /* skip any leading white space */