coverity 1164092

This commit is contained in:
Nicolas Williams
2015-04-18 23:18:08 -05:00
parent 0e524f3acb
commit 528b6d093c

View File

@@ -1178,10 +1178,12 @@ getdata(char **p, unsigned char *buf, size_t len, const char *what)
size_t i;
int v;
char *q = nexttoken(p, 0, what);
if (q == NULL)
if (q == NULL) {
warnx("Failed to find hex-encoded binary data (%s) in dump", what);
return 0;
}
i = 0;
while(*q && i < len) {
while (*q && i < len) {
if(sscanf(q, "%02x", &v) != 1)
break;
buf[i++] = v;