libfetch: extra bounds checking through reallocarray(3).

Reviewed by:	des
MFC after:	1 week
This commit is contained in:
Pedro F. Giffuni 2017-03-06 15:38:03 +00:00
parent bb7d0109d7
commit 0012b66baf

View File

@ -1306,7 +1306,7 @@ fetch_add_entry(struct url_ent **p, int *size, int *len,
}
if (*len >= *size - 1) {
tmp = realloc(*p, (*size * 2 + 1) * sizeof(**p));
tmp = reallocarray(*p, *size * 2 + 1, sizeof(**p));
if (tmp == NULL) {
errno = ENOMEM;
fetch_syserr();