Skip to content

Commit

Permalink
Merge pull request #31 from IVOES/cpp/missing-check-scanf
Browse files Browse the repository at this point in the history
Check that a call to 'sscanf' actually writes to an output variable
  • Loading branch information
zevv authored Jun 10, 2023
2 parents fc6c1c0 + 4830f87 commit c3cfece
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/linux/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ zf_cell zf_host_parse_num(const char *buf)
zf_cell v;
int n = 0;
int r = sscanf(buf, "%f%n", &v, &n);
if(r == 0 || buf[n] != '\0') {
if(r != 1 || buf[n] != '\0') {
zf_abort(ZF_ABORT_NOT_A_WORD);
}
return v;
Expand Down

0 comments on commit c3cfece

Please sign in to comment.