]> git.sur5r.net Git - openldap/commitdiff
Import fixes from HEAD - ITS#1936 and res_query reply buffer sizes
authorHoward Chu <hyc@openldap.org>
Mon, 26 Aug 2002 13:30:51 +0000 (13:30 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 26 Aug 2002 13:30:51 +0000 (13:30 +0000)
libraries/libldap/dnssrv.c

index 00de1dae58fdd90627ed454ee8de49a443536688..2fc07442d295984326ac6eac3a01692dbf76cfb3 100644 (file)
@@ -195,10 +195,11 @@ int ldap_domain2hostlist(
        char **list )
 {
 #ifdef HAVE_RES_QUERY
+#define DNSBUFSIZ (64*1024)
     char *request;
     char *hostlist = NULL;
     int rc, len, cur = 0;
-    unsigned char reply[1024];
+    unsigned char reply[DNSBUFSIZ];
 
        if( domain == NULL || *domain == '\0' ) {
                return LDAP_PARAM_ERROR;
@@ -222,7 +223,7 @@ int ldap_domain2hostlist(
     len = res_query(request, C_IN, T_SRV, reply, sizeof(reply));
     if (len >= 0) {
        unsigned char *p;
-       char host[1024];
+       char host[DNSBUFSIZ];
        int status;
        u_short port;
        /* int priority, weight; */
@@ -263,7 +264,7 @@ int ldap_domain2hostlist(
                /* weight = (p[2] << 8) | p[3]; */
                port = (p[4] << 8) | p[5];
 
-               buflen = strlen(host) + sizeof(":65355");
+               buflen = strlen(host) + sizeof(":65355 ");
                hostlist = (char *) LDAP_REALLOC(hostlist, cur + buflen);
                if (hostlist == NULL) {
                    rc = LDAP_NO_MEMORY;