catch case where we could BOF should_buffer[]

[skip ci]
This commit is contained in:
Steffen Jaeckel 2017-09-20 17:29:05 +02:00
parent b6213309ca
commit 9a83397376

View File

@ -98,6 +98,11 @@ static void check_file(int argn, int argc, char **argv)
hash_len = space - s;
hash_len /= 2;
if (hash_len > sizeof(should_buffer)) {
fprintf(stderr, "%s: hash too long\n", hashsum);
goto ERR;
}
/* convert the hex-string back to binary */
for (x = 0; x < hash_len; ++x) {
should_buffer[x] = HEXOF(s[x*2]) << 4 | HEXOF(s[x*2 + 1]);