Skip to content

Commit a14fed4

Browse files
committed
Check that getaddrinfo set the addresses
1 parent f5dc8b7 commit a14fed4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

extension/maxminddb.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ static int ip_converter(PyObject *obj, struct sockaddr_storage *ip_address)
212212
ipstr);
213213
return 0;
214214
}
215+
if (!addresses) {
216+
PyErr_SetString(PyExc_RuntimeError,
217+
"getaddrinfo was successful but failed to set the addrinfo");
218+
219+
}
215220
memcpy(ip_address, addresses->ai_addr, addresses->ai_addrlen);
216221
freeaddrinfo(addresses);
217222
return 1;

0 commit comments

Comments
 (0)