Skip to content

Commit

Permalink
lib_sscanf: fixed a hang in scanf() on end of string
Browse files Browse the repository at this point in the history
if we reach end of buffer when we are not on a format specifier then
the code would loop forever.
  • Loading branch information
Andrew Tridgell committed Nov 6, 2014
1 parent 423d6b0 commit dacbc6a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libc/stdio/lib_sscanf.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,10 @@ int vsscanf(FAR char *buf, FAR const char *fmt, va_list ap)
buf++;
}
}
else {
/* it is not a format specifier, and buf is empty. Stop matching */
break;
}
}

/* Clean up - read whitespaces */
Expand Down

0 comments on commit dacbc6a

Please sign in to comment.