[Bug network/16469] getaddrinfo incorrectly accepts two trailing dots

aoliva at sourceware dot org sourceware-bugzilla@sourceware.org
Sat Sep 27 10:40:00 GMT 2014


https://sourceware.org/bugzilla/show_bug.cgi?id=16469

Alexandre Oliva <aoliva at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |aoliva at sourceware dot org
           Assignee|unassigned at sourceware dot org   |aoliva at sourceware dot org

--- Comment #1 from Alexandre Oliva <aoliva at sourceware dot org> ---
This patchlet appears to fix it.

diff --git a/resolv/res_query.c b/resolv/res_query.c
index e4ee2a6..338ad82 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -561,10 +561,6 @@ __libc_res_nquerydomain(res_state statp,
                name, domain?domain:"<Nil>", class, type);
 #endif
     if (domain == NULL) {
-        /*
-         * Check for trailing '.';
-         * copy without '.' if present.
-         */
         n = strlen(name);

         /* Decrement N prior to checking it against MAXDNAME
@@ -575,11 +571,7 @@ __libc_res_nquerydomain(res_state statp,
             RES_SET_H_ERRNO(statp, NO_RECOVERY);
             return (-1);
         }
-        if (name[n] == '.') {
-            strncpy(nbuf, name, n);
-            nbuf[n] = '\0';
-        } else
-            longname = name;
+        longname = name;
     } else {
         n = strlen(name);
         d = strlen(domain);

-- 
You are receiving this mail because:
You are on the CC list for the bug.



More information about the Glibc-bugs mailing list