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

Give this copy/pasted resolve_ip() the same fixes as main.cpp and mailsrvr.c

Don't deref a null pointer and return an in_addr_t instead of ulong.
parent 7678e097
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -19,13 +19,13 @@ static int log_opts=LOG_CONS;
static char syslog_tag[33]="undefined";
static int default_facility=LOG_USER;
static u_long resolve_ip(char *addr)
static in_addr_t resolve_ip(char *addr)
{
HOSTENT* host;
char* p;
if(*addr==0)
return((u_long)INADDR_NONE);
return INADDR_NONE;
for(p=addr;*p;p++)
if(*p!='.' && !isdigit(*p))
......@@ -33,8 +33,10 @@ static u_long resolve_ip(char *addr)
if(!(*p))
return(inet_addr(addr));
if((host=gethostbyname(addr))==NULL)
return((u_long)INADDR_NONE);
return(*((ulong*)host->h_addr_list[0]));
return INADDR_NONE;
if(host->h_addr_list == NULL)
return INADDR_NONE;
return *((in_addr_t*)host->h_addr_list[0]);
}
void xp_set_loghost(const char *hostname)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment