about summary refs log tree commit diff
path: root/nscd/nscd_helper.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-13 06:07:02 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-13 06:07:02 +0000
commit407c4b9a19fc59dfea131c08b3075108ecfab8a3 (patch)
tree7533c2788bb96d8392b8f75663e8795c38b88fd3 /nscd/nscd_helper.c
parent568470bbff2c86996cbb7ebb5411a2b5d4c46fe4 (diff)
downloadglibc-407c4b9a19fc59dfea131c08b3075108ecfab8a3.tar.gz
glibc-407c4b9a19fc59dfea131c08b3075108ecfab8a3.tar.xz
glibc-407c4b9a19fc59dfea131c08b3075108ecfab8a3.zip
UPdate.
	* nscd/nscd_helper.c (get_mapping): Correctly check cmsg length.
	Avoid file descriptor leak in case of size mismatch.
Diffstat (limited to 'nscd/nscd_helper.c')
-rw-r--r--nscd/nscd_helper.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index 74983b9762..ff27b0797e 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -138,10 +138,12 @@ get_mapping (request_type type, const char *key,
     /* Failure or timeout.  */
     goto out_close2;
 
-  if (TEMP_FAILURE_RETRY (__recvmsg (sock, &msg, 0)) != keylen
-      || msg.msg_controllen != CMSG_LEN (sizeof (int)))
+  if (TEMP_FAILURE_RETRY (__recvmsg (sock, &msg, 0)) != keylen)
     goto out_close2;
 
+  if (CMSG_FIRSTHDR (&msg)->cmsg_len != CMSG_LEN (sizeof (int)))
+    goto out_close;
+
   mapfd = *(int *) CMSG_DATA (cmsg);
 
   struct stat64 st;