From: Alan Cox Date: Thu, 9 Nov 2017 23:09:05 +0000 (+0000) Subject: gethostbyname: this crashes with a null pointer trap X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=7468cf34760d72b29e653e650cdf3e9a4e15cf96;p=FUZIX.git gethostbyname: this crashes with a null pointer trap Fix up what I think was intended --- diff --git a/Applications/netd/gethostbyname.c b/Applications/netd/gethostbyname.c index 188be6bd..75c1cabf 100644 --- a/Applications/netd/gethostbyname.c +++ b/Applications/netd/gethostbyname.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "netdb.h" /* DNS packet header */ @@ -109,6 +110,7 @@ static struct hostent host={ /* static returned hostent struct */ /* Get a host by it's name */ struct hostent *gethostbyname( char *name ){ struct sockaddr_in addr; + static uint32_t av; int x; int tries = 5; int lno=0; @@ -117,8 +119,9 @@ struct hostent *gethostbyname( char *name ){ char *ws = " \f\n\r\t\v"; /* Try to just translate passed stringified IP address */ - x = inet_pton( AF_INET, name, list[0] ); + x = inet_pton( AF_INET, name, &av ); if( x == 1 ){ + list[0] = (void *)&av; list[1] = NULL; return &host; }