libfetch: extra bounds checking through reallocarray(3).

Reviewed by:	des
MFC after:	1 week
This commit is contained in:
pfg 2017-03-06 15:38:03 +00:00
parent fa1e43b6f7
commit e40a47ae83

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();