[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
(ITS#6644) wrong conversion specifier for "port" in "ldap_domain2hostlist"
Full_Name: Manuel Gaupp
Version: 2.4.23
OS: Linux 2.6/x86
URL:
Submission from: (NULL) (93.222.138.193)
Hi,
when using ldap_domain2hostlist to get informations from DNS SRV RRs, there is
an issue for ports > 32767. For example, when a DNS SRV RR _ldap._tcp is
referenced to port 63677 on a specific host, the returned hostlist contains port
-1859.
The error is caused by a wrong conversion in libldap/dnssrv.c, line 292. In this
sprintf line, the unsigned short "port" is converted using "%hd" instead of
"%hu".
The attached patch should fix this issue (it did in my case).
Regards,
Manuel
--- openldap-2.4.23-orig/libraries/libldap/dnssrv.c 2010-04-13
22:22:56.000000000 +0200
+++ openldap-2.4.23/libraries/libldap/dnssrv.c 2010-09-09 13:41:27.000000000
+0200
@@ -289,7 +289,7 @@ int ldap_domain2hostlist(
/* not first time around */
hostlist[cur++] = ' ';
}
- cur += sprintf(&hostlist[cur], "%s:%hd", host, port);
+ cur += sprintf(&hostlist[cur], "%s:%hu", host, port);
}
add_size:;
p += size;