Fix off-by-one error that enabled the fuzzer to find a crash hole.
One has to allocate space for the trailing NUL, too.
This commit is contained in:
parent
d747d43429
commit
018ca9ae37
1 changed files with 1 additions and 1 deletions
2
misc.c
2
misc.c
|
@ -291,7 +291,7 @@ bool YES(const char* question, const char* yes_response, const char* no_response
|
||||||
|
|
||||||
reply = get_input();
|
reply = get_input();
|
||||||
|
|
||||||
char* firstword = (char*) xmalloc(strlen(reply));
|
char* firstword = (char*) xmalloc(strlen(reply)+1);
|
||||||
sscanf(reply, "%s", firstword);
|
sscanf(reply, "%s", firstword);
|
||||||
|
|
||||||
for (int i = 0; i < (int)strlen(firstword); ++i)
|
for (int i = 0; i < (int)strlen(firstword); ++i)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue