From: Pierangelo Masarati Date: Tue, 21 Sep 2010 00:05:36 +0000 (+0000) Subject: don't use lud_host when NULL (ITS#6653, fixed differently) X-Git-Tag: MIGRATION_CVS2GIT~474 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9d77d613142f11c3f3943a92b52fe150314b31f1;p=openldap don't use lud_host when NULL (ITS#6653, fixed differently) --- diff --git a/libraries/libldap/url.c b/libraries/libldap/url.c index 2c4094cb9c..4e641a3706 100644 --- a/libraries/libldap/url.c +++ b/libraries/libldap/url.c @@ -1425,6 +1425,7 @@ ldap_url_list2hosts (LDAPURLDesc *ludlist) /* figure out how big the string is */ size = 1; /* nul-term */ for (ludp = ludlist; ludp != NULL; ludp = ludp->lud_next) { + if ( ludp->lud_host == NULL ) continue; size += strlen(ludp->lud_host) + 1; /* host and space */ if (strchr(ludp->lud_host, ':')) /* will add [ ] below */ size += 2; @@ -1437,6 +1438,7 @@ ldap_url_list2hosts (LDAPURLDesc *ludlist) p = s; for (ludp = ludlist; ludp != NULL; ludp = ludp->lud_next) { + if ( ludp->lud_host == NULL ) continue; if (strchr(ludp->lud_host, ':')) { p += sprintf(p, "[%s]", ludp->lud_host); } else { @@ -1449,7 +1451,7 @@ ldap_url_list2hosts (LDAPURLDesc *ludlist) } if (p != s) p--; /* nuke that extra space */ - *p = 0; + *p = '\0'; return s; }