Skip to content
Snippets Groups Projects
Commit fb11866c authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix potential NULL pointer deref in rblchk(), observed via segfault lately

I'm not sure why this one only started popping up now, but h_addr_list is a
NULL-terminated list and it makes perfect sense that the first entry could
be the NULL-terminator.

gethostbyname is obsolete/deprecated and we should address that in a separate
commit.
parent 08f465db
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4417 passed
...@@ -1833,6 +1833,9 @@ static ulong rblchk(SOCKET sock, const char* prot, union xp_sockaddr *addr, cons ...@@ -1833,6 +1833,9 @@ static ulong rblchk(SOCKET sock, const char* prot, union xp_sockaddr *addr, cons
if((host=gethostbyname(name))==NULL) if((host=gethostbyname(name))==NULL)
return(0); return(0);
if(host->h_addr_list[0] == NULL)
return 0;
dnsbl_result.s_addr = *((ulong*)host->h_addr_list[0]); dnsbl_result.s_addr = *((ulong*)host->h_addr_list[0]);
lprintf(LOG_INFO,"%04d %s DNSBL Query: %s resolved to: %s" lprintf(LOG_INFO,"%04d %s DNSBL Query: %s resolved to: %s"
,sock,prot,name,inet_ntoa(dnsbl_result)); ,sock,prot,name,inet_ntoa(dnsbl_result));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment