From 03d640de435c1c37675edf70fc2d96c74b9c922f Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Wed, 9 Aug 2006 03:43:20 +0000 Subject: [PATCH] ITS#4610 fix. --- CHANGES | 1 + libraries/libldap/dnssrv.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 69f61b6c77..2374cd4c69 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ OpenLDAP 2.3 Change Log OpenLDAP 2.3.26 Engineering Fixed slapd incorrect rebuilding of replica URI (ITS#4633) Fixed back-monitor operations order via callbacks (ITS#4631) + Fixed libldap dnssrv bug with "not present" positive statement (ITS#4610) OpenLDAP 2.3.25 Release Fixed liblber ber_bvreplace_x argument checks diff --git a/libraries/libldap/dnssrv.c b/libraries/libldap/dnssrv.c index 3090c66d4d..3d69b557d1 100644 --- a/libraries/libldap/dnssrv.c +++ b/libraries/libldap/dnssrv.c @@ -275,8 +275,12 @@ int ldap_domain2hostlist( /* weight = (p[2] << 8) | p[3]; */ port = (p[4] << 8) | p[5]; - buflen = strlen(host) + sizeof(":65355 "); - hostlist = (char *) LDAP_REALLOC(hostlist, cur + buflen); + if ( port == 0 || host[ 0 ] == '\0' ) { + goto add_size; + } + + buflen = strlen(host) + STRLENOF(":65355 "); + hostlist = (char *) LDAP_REALLOC(hostlist, cur + buflen + 1); if (hostlist == NULL) { rc = LDAP_NO_MEMORY; goto out; @@ -287,6 +291,7 @@ int ldap_domain2hostlist( } cur += sprintf(&hostlist[cur], "%s:%hd", host, port); } +add_size:; p += size; } } -- 2.39.5