[Python-checkins] r51291 - python/trunk/Modules/socketmodule.c
georg.brandl
python-checkins at python.org
Tue Aug 15 00:10:25 CEST 2006
Author: georg.brandl
Date: Tue Aug 15 00:10:24 2006
New Revision: 51291
Modified:
python/trunk/Modules/socketmodule.c
Log:
Patch #1511317: don't crash on invalid hostname info
Modified: python/trunk/Modules/socketmodule.c
==============================================================================
--- python/trunk/Modules/socketmodule.c (original)
+++ python/trunk/Modules/socketmodule.c Tue Aug 15 00:10:24 2006
@@ -3041,17 +3041,20 @@
if ((addr_list = PyList_New(0)) == NULL)
goto err;
- for (pch = h->h_aliases; *pch != NULL; pch++) {
- int status;
- tmp = PyString_FromString(*pch);
- if (tmp == 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);
+ if (tmp == NULL)
+ goto err;
- status = PyList_Append(name_list, tmp);
- Py_DECREF(tmp);
+ status = PyList_Append(name_list, tmp);
+ Py_DECREF(tmp);
- if (status)
- goto err;
+ if (status)
+ goto err;
+ }
}
for (pch = h->h_addr_list; *pch != NULL; pch++) {
More information about the Python-checkins
mailing list