Misc fixes (coverity)

This commit is contained in:
Nicolas Williams
2016-11-20 17:43:07 -06:00
parent 6696920d9e
commit f38089257b
19 changed files with 105 additions and 81 deletions

View File

@@ -1212,7 +1212,7 @@ getdata(char **p, unsigned char *buf, size_t len, const char *what)
}
i = 0;
while (*q && i < len) {
if(sscanf(q, "%02x", &v) != 1)
if (sscanf(q, "%02x", &v) != 1)
break;
buf[i++] = v;
q += 2;
@@ -1229,7 +1229,8 @@ getint(char **p, const char *what)
warnx("Failed to find a signed integer (%s) in dump", what);
return -1;
}
sscanf(q, "%d", &val);
if (sscanf(q, "%d", &val) != 1)
return -1;
return val;
}
@@ -1242,7 +1243,8 @@ getuint(char **p, const char *what)
warnx("Failed to find an unsigned integer (%s) in dump", what);
return 0;
}
sscanf(q, "%u", &val);
if (sscanf(q, "%u", &val) != 1)
return 0;
return val;
}