Fix out-of-bounds memory access.

pull/2/head
Markus Böhme 2017-03-14 14:14:59 +01:00
parent 8ca7eb3428
commit 1d365fbdf0
1 changed files with 1 additions and 1 deletions

View File

@ -1189,7 +1189,7 @@ command_extract(struct optparse *options)
size_t len = strlen(infile);
if (len <= slen || strcmp(suffix, infile + len - slen) != 0)
fatal("could not determine output filename from %s", infile);
outfile = malloc(len - slen);
outfile = malloc(len - slen + 1);
if (!outfile)
fatal("out of memory");
memcpy(outfile, infile, len - slen);