The hostent->h_addr_list ends with a NULL pointer, take it into account
when checking the provided buffer length.
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
return -1;
}
- if (buflen < (addr_list->count * sizeof(void *))) {
+ /* +1 i for ending NULL pointer */
+ if (buflen < ((addr_list->count + 1) * sizeof(void *))) {
SAFE_FREE(addr_list->items);
SAFE_FREE(addr_list);
return ERANGE;