roken: getaddrinfo get_null return errors
get_null() can fail for two reasons. There can be a memory allocation issue or the hints->ai_family could be unsupported. This change informs the caller of the error state instead of returning success with an invalid struct addrinfo output parameter. Fixes #1007 Reported-by: opless
This commit is contained in:
@@ -188,7 +188,7 @@ get_null (const struct addrinfo *hints,
|
||||
struct addrinfo *first = NULL;
|
||||
struct addrinfo **current = &first;
|
||||
int family = PF_UNSPEC;
|
||||
int ret;
|
||||
int ret = EAI_FAMILY;
|
||||
|
||||
if (hints != NULL)
|
||||
family = hints->ai_family;
|
||||
@@ -216,7 +216,7 @@ get_null (const struct addrinfo *hints,
|
||||
¤t, const_v4, &v4_addr, NULL);
|
||||
}
|
||||
*res = first;
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Reference in New Issue
Block a user