aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-05-29 14:45:49 +0000
committerUlrich Drepper <drepper@redhat.com>2007-05-29 14:45:49 +0000
commit5da4373cfd0bf070ec3ece378c4dea9b027c0ce2 (patch)
tree71dad8c9e0054210c9357b953fac1c842f9f797c
parent40f57573d02e98db90f7d9e1dae6c3422d150d7b (diff)
downloadglibc-5da4373cfd0bf070ec3ece378c4dea9b027c0ce2.zip
glibc-5da4373cfd0bf070ec3ece378c4dea9b027c0ce2.tar.gz
glibc-5da4373cfd0bf070ec3ece378c4dea9b027c0ce2.tar.bz2
* 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--ChangeLog8
-rw-r--r--nscd/nscd_helper.c7
2 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 5f17fd5..0851e6d 100644
--- 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-28 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/futimes.c (miss_utimensat): Don't define
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index 1f56ccf..bab4913 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -271,9 +271,10 @@ get_mapping (request_type type, const char *key,
mapfd = *(int *) CMSG_DATA (cmsg);
- if (__builtin_expect (CMSG_FIRSTHDR (&msg)->cmsg_len
- != CMSG_LEN (sizeof (int)), 0))
- goto out_close;
+ if (__builtin_expect (CMSG_FIRSTHDR (&msg) == NULL
+ || (CMSG_FIRSTHDR (&msg)->cmsg_len
+ != CMSG_LEN (sizeof (int))), 0))
+ goto out_close2;
struct stat64 st;
if (__builtin_expect (strcmp (resdata, key) != 0, 0)