about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPino Toscano <toscano.pino@tiscali.it>2012-05-10 15:30:38 -0700
committerRoland McGrath <roland@hack.frob.com>2012-05-10 15:57:27 -0700
commit37ed8b9bdc820a23d5884132d0278d9e42942fd3 (patch)
tree7f64ec8a13116217538679d0201b98e8e5df15ee
parentb29d4053f0bda40f052cf69019e4198a21c67efb (diff)
downloadglibc-37ed8b9bdc820a23d5884132d0278d9e42942fd3.tar.gz
glibc-37ed8b9bdc820a23d5884132d0278d9e42942fd3.tar.xz
glibc-37ed8b9bdc820a23d5884132d0278d9e42942fd3.zip
Hurd: recvfrom(): take into account null address ports
-rw-r--r--ChangeLog9
-rw-r--r--sysdeps/mach/hurd/recvfrom.c6
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1591ca9e17..ac0ad18976 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,12 @@
+2012-05-10  Pino Toscano  <toscano.pino@tiscali.it>
+
+	* sysdeps/mach/hurd/recvfrom.c (__recvfrom): Check also for a null
+	address port.  Set ADDR_LEN to 0 when not filling ADDRARG.
+
 2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
 
-        * sysdeps/mach/hurd/readlinkat.c: New file, heavily derived from
-        sysdeps/mach/hurd/readlink.c.
+	* sysdeps/mach/hurd/readlinkat.c: New file, heavily derived from
+	sysdeps/mach/hurd/readlink.c.
 
 	* posix/tst-sysconf.c (posix_options): Only use
 	_POSIX_PRIORITIZED_IO, _POSIX_PRIORITY_SCHEDULING, and
diff --git a/sysdeps/mach/hurd/recvfrom.c b/sysdeps/mach/hurd/recvfrom.c
index f591336115..3a094aa0d2 100644
--- a/sysdeps/mach/hurd/recvfrom.c
+++ b/sysdeps/mach/hurd/recvfrom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997, 1999, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -54,7 +54,7 @@ __recvfrom (fd, buf, n, flags, addrarg, addr_len)
     return __hurd_sockfail (fd, flags, err);
 
   /* Get address data for the returned address port if requested.  */
-  if (addr != NULL)
+  if (addr != NULL && addrport != MACH_PORT_NULL)
     {
       char *buf = (char *) addr;
       mach_msg_type_number_t buflen = *addr_len;
@@ -88,6 +88,8 @@ __recvfrom (fd, buf, n, flags, addrarg, addr_len)
       if (buflen > 0)
 	addr->sa_family = type;
     }
+  else if (addr_len != NULL)
+    *addr_len = 0;
 
   __mach_port_deallocate (__mach_task_self (), addrport);