Avoid checking the lengh of a null string.

This commit is contained in:
Andrew Thompson 2010-10-18 03:18:35 -04:00
parent dc40a7789c
commit 1ffff099c1
1 changed files with 2 additions and 1 deletions

View File

@ -377,10 +377,11 @@ switch_status_t initialise_ei(struct ei_cnode_s *ec)
// init the resolver // init the resolver
res_init(); res_init();
} }
if (!zstr_buf(_res.dnsrch[0])) { if (_res.dnsrch[0] && !zstr_buf(_res.dnsrch[0])) {
strncat(thishostname, ".", 1); strncat(thishostname, ".", 1);
strncat(thishostname, _res.dnsrch[0], EI_MAXHOSTNAMELEN - strlen(thishostname)); strncat(thishostname, _res.dnsrch[0], EI_MAXHOSTNAMELEN - strlen(thishostname));
} }
} }
snprintf(thisnodename, MAXNODELEN + 1, "%s@%s", prefs.nodename, thishostname); snprintf(thisnodename, MAXNODELEN + 1, "%s@%s", prefs.nodename, thishostname);
} }