Commit 9dc7b7ce authored by Georg Brandl's avatar Georg Brandl

Patch #1511317: don't crash on invalid hostname info

parent d76bd697
......@@ -3041,6 +3041,8 @@ gethost_common(struct hostent *h, struct sockaddr *addr, int alen, int af)
if ((addr_list = PyList_New(0)) == NULL)
goto err;
/* SF #1511317: h_aliases can be NULL */
if (h->h_aliases) {
for (pch = h->h_aliases; *pch != NULL; pch++) {
int status;
tmp = PyString_FromString(*pch);
......@@ -3053,6 +3055,7 @@ gethost_common(struct hostent *h, struct sockaddr *addr, int alen, int af)
if (status)
goto err;
}
}
for (pch = h->h_addr_list; *pch != NULL; pch++) {
int status;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment