Skip to content

Commit

Permalink
Check the result of a "sscanf" call
Browse files Browse the repository at this point in the history
This was being reported as a warning by GCC.  The fix is trivial: just
check the return code from sscanf and bail out of check_mount_line()
whenever we don't get the right number of parsed elements.
  • Loading branch information
palmer-dabbelt authored and hansendc committed Mar 14, 2015
1 parent 0bf79af commit f59ff31
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eyefi-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ static char *check_mount_line(int line_nr, char *line)
read = sscanf(&line[0], "%s %s %s %s %d %d",
&dev[0], &mnt[0], &fs[0], &opt[0],
&garb1, &garb2);
if (read != 6) {
debug_printf(2, "Unable to parse mount line: '%s'\n", line);
return NULL;
}
// only look at fat filesystems:
if (!fs_is(fs, "msdos") && !fs_is(fs, "vfat")) {
debug_printf(4, "fs[%d] at '%s' is not fat, skipping...\n",
Expand Down

0 comments on commit f59ff31

Please sign in to comment.