upas: fix segfault when host not found

R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/5370105
This commit is contained in:
David du Colombier 2011-11-21 08:40:17 -05:00 committed by Russ Cox
parent 81c30b5a75
commit 38bcdc42b5

View file

@ -465,6 +465,9 @@ sysnames_read(void)
return namev;
h = gethostbyname(alt_sysname_read());
if(h == nil)
return 0;
for(p=h->h_aliases; *p; p++)
;
@ -491,7 +494,7 @@ domainname_read(void)
char **namev, *p;
Ndbtuple *t;
for(namev = sysnames_read(); *namev; namev++){
for(namev = sysnames_read(); namev && *namev; namev++){
if(strchr(*namev, '.')){
for(p=*namev-1; p && *++p; p=strchr(p, '.')){
if((t = dnsquery(nil, p, "mx")) != nil){