Skip to content

Commit

Permalink
Use reallocarray in pick-test
Browse files Browse the repository at this point in the history
  • Loading branch information
mptre committed Jul 17, 2017
1 parent be071ec commit 58b17e0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions tests/pick-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ parsekeys(const char *s)
buf[len++] = c;

if (size <= len) {
if (size > ULONG_MAX/2)
errx(1, "buffer size overflow");
if ((buf = realloc(buf, 2*size)) == NULL)
if ((buf = reallocarray(buf, 2, size)) == NULL)
err(1, NULL);
size *= 2;
}
Expand Down

0 comments on commit 58b17e0

Please sign in to comment.