]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* nscd/nscd_helper.c (get_mapping): Handle short replies instead
authorJakub Jelinek <jakub@redhat.com>
Sat, 7 Jul 2007 16:15:16 +0000 (16:15 +0000)
committerJakub Jelinek <jakub@redhat.com>
Sat, 7 Jul 2007 16:15:16 +0000 (16:15 +0000)
of crashing.  When this is the case or if the reply is malformed,
don't try to close the new file descriptor since it does not
exist.
Patch in part by Guillaume Chazarain <guichaz@yahoo.fr>.

ChangeLog
nscd/nscd_helper.c

index 4c62a99c50234481dfdcab2ef5e3498d97298aff..6b20f8fd571d6eefcbb54fcb9b6e54cc05a78458 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-05-29  Ulrich Drepper  <drepper@redhat.com>
+
+       * nscd/nscd_helper.c (get_mapping): Handle short replies instead
+       of crashing.  When this is the case or if the reply is malformed,
+       don't try to close the new file descriptor since it does not
+       exist.
+       Patch in part by Guillaume Chazarain <guichaz@yahoo.fr>.
+
 2007-05-21  Ulrich Drepper  <drepper@redhat.com>
 
        * sysdeps/x86_64/cacheinfo.c (init_cacheinfo): Pass correct value
index 1f56ccf6aad542a3e7ca6d5a6fc124f3ab53fe0b..79644a4da19c3487b3ad3ccbe371c544cc37d668 100644 (file)
@@ -269,11 +269,12 @@ get_mapping (request_type type, const char *key,
                        != keylen, 0))
     goto out_close2;
 
-  mapfd = *(int *) CMSG_DATA (cmsg);
+  if (__builtin_expect (CMSG_FIRSTHDR (&msg) == NULL
+                       || (CMSG_FIRSTHDR (&msg)->cmsg_len
+                           != CMSG_LEN (sizeof (int))), 0))
+    goto out_close2;
 
-  if (__builtin_expect (CMSG_FIRSTHDR (&msg)->cmsg_len
-                       != CMSG_LEN (sizeof (int)), 0))
-    goto out_close;
+  mapfd = *(int *) CMSG_DATA (cmsg);
 
   struct stat64 st;
   if (__builtin_expect (strcmp (resdata, key) != 0, 0)