From: Jakub Jelinek Date: Thu, 12 Jul 2007 15:27:53 +0000 (+0000) Subject: 2007-05-29 Ulrich Drepper X-Git-Tag: cvs/fedora-glibc-2_5-20070712T1701~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b4675550e09218bdc18eae6eac118f0a7fb12df;p=thirdparty%2Fglibc.git 2007-05-29 Ulrich Drepper * 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 . --- diff --git a/ChangeLog b/ChangeLog index a9f72390a21..47c98b6603d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-05-29 Ulrich Drepper + + * 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 . + 2007-05-21 Jakub Jelinek [BZ #4514] diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c index af685a590bd..ccbe576bedd 100644 --- a/nscd/nscd_helper.c +++ b/nscd/nscd_helper.c @@ -242,11 +242,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)