Fixed a problem with PlatformGetLine() which was causing a buffer overrun.
With thanks to mark@heilpern.com. Issue #581. git-svn-id: http://picoc.googlecode.com/svn/trunk@602 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
6e9b4b3c84
commit
ed54c51916
|
@ -46,9 +46,9 @@ char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt)
|
|||
if (InLine == NULL)
|
||||
return NULL;
|
||||
|
||||
Buf[MaxLen] = '\0';
|
||||
strncpy(Buf, InLine, MaxLen-1);
|
||||
strncat(Buf, "\n", MaxLen-1);
|
||||
Buf[MaxLen-1] = '\0';
|
||||
strncpy(Buf, InLine, MaxLen-2);
|
||||
strncat(Buf, "\n", MaxLen-2);
|
||||
|
||||
if (InLine[0] != '\0')
|
||||
add_history(InLine);
|
||||
|
|
Loading…
Reference in a new issue