< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate-users] Maybe a bug in DnsUtil


> From: Karlsson <boost.regex@xxxxxxxxx>
> 
> In the DnsUtil.xx, below code:
> 
>       int res = getaddrinfo(buffer, 0, &hints, &result);
>       if (!res)
>       {
>          // !jf! this should really use the Data class
>          if (strchr(result->ai_canonname, '.') != 0)
>          {
>             strncpy(buffer, result->ai_canonname, sizeof(buffer));
>          }
>       }
> 
> *It's seems sometime the result is NULL will cause the app crashed.*

If getaddrinfo returns NULL, then res == NULL, and the if-part will
not be executed.

Dale