[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
(ITS#6653) Segfault when getting LDAP_OPT_HOST_NAME and URI = ldapi://
- To: openldap-its@OpenLDAP.org
- Subject: (ITS#6653) Segfault when getting LDAP_OPT_HOST_NAME and URI = ldapi://
- From: jargon@molb.org
- Date: Mon, 20 Sep 2010 21:24:53 GMT
- Auto-submitted: auto-generated (OpenLDAP-ITS)
Full_Name: Johannes Weißl
Version: HEAD
OS: Debian GNU/Linux AMD64
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (93.104.127.153)
This is only a minor issue:
When URI is e.g. ldapi:// in ldap.conf and ldap_get_option() for
LDAP_OPT_HOST_NAME is called, ldap_url_list2hosts() [url.c:1416] segfaults
because the lud_host field in LDAPURLDesc is NULL. Adding an additional test in
the loop header fixes this bug:
diff -Naur openldap/libraries/libldap/url.c
openldap.new/libraries/libldap/url.c
--- openldap/libraries/libldap/url.c 2010-04-13 22:17:57.000000000 +0200
+++ openldap.new/libraries/libldap/url.c 2010-09-20 22:44:58.325892001 +0200
@@ -1424,7 +1424,7 @@
/* figure out how big the string is */
size = 1; /* nul-term */
- for (ludp = ludlist; ludp != NULL; ludp = ludp->lud_next) {
+ for (ludp = ludlist; ludp != NULL && ludp->lud_host != NULL; ludp =
ludp->lud_next) {
size += strlen(ludp->lud_host) + 1; /* host and space */
if (strchr(ludp->lud_host, ':')) /* will add [ ] below */
size += 2;
@@ -1436,7 +1436,7 @@
return NULL;
p = s;
- for (ludp = ludlist; ludp != NULL; ludp = ludp->lud_next) {
+ for (ludp = ludlist; ludp != NULL && ludp->lud_host != NULL; ludp =
ludp->lud_next) {
if (strchr(ludp->lud_host, ':')) {
p += sprintf(p, "[%s]", ludp->lud_host);
} else {