Skip to content

Commit

Permalink
Merge pull request #1648 from stweil/fix
Browse files Browse the repository at this point in the history
scanutils: Fix illegal memory access
  • Loading branch information
zdenop authored Jun 8, 2018
2 parents a662306 + 280db06 commit 89730e1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ccutil/scanutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,10 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) {

case 's': // String
{
char *sp;
sp = sarg = va_arg(ap, char *);
if (!(flags & FL_SPLAT)) {
sarg = va_arg(ap, char *);
}
char *sp = sarg;
while (width--) {
q = fgetc(stream);
if (isspace(static_cast<unsigned char>(q)) || q <= 0) {
Expand All @@ -488,7 +490,6 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) {
} else if (!(flags & FL_SPLAT)) {
*sp = '\0'; // Terminate output
converted++;
} else {
}
}
break;
Expand Down

0 comments on commit 89730e1

Please sign in to comment.