diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 15:27:53 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 15:27:53 +0000 |
commit | 5b4675550e09218bdc18eae6eac118f0a7fb12df (patch) | |
tree | f8702e6147ac96758a82f8a5ea106db6c05aaca4 | |
parent | 1b5b08a2afb07a5275c2a7066a4bfff944d79bd2 (diff) | |
download | glibc-5b4675550e09218bdc18eae6eac118f0a7fb12df.tar glibc-5b4675550e09218bdc18eae6eac118f0a7fb12df.tar.gz glibc-5b4675550e09218bdc18eae6eac118f0a7fb12df.tar.bz2 glibc-5b4675550e09218bdc18eae6eac118f0a7fb12df.zip |
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>.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | nscd/nscd_helper.c | 9 |
2 files changed, 13 insertions, 4 deletions
@@ -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 Jakub Jelinek <jakub@redhat.com> [BZ #4514] diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c index af685a590b..ccbe576bed 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) |