about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPino Toscano <toscano.pino@tiscali.it>2012-05-10 15:35:47 -0700
committerRoland McGrath <roland@hack.frob.com>2012-05-10 15:57:28 -0700
commit63643c85d4c47512decc16f35124160629c39a86 (patch)
treefe9f1c95517fed2dbd97f8a175e8019459b0403b
parent3faebe6abc04ea8d632bee4537948ca85479c09a (diff)
downloadglibc-63643c85d4c47512decc16f35124160629c39a86.tar.gz
glibc-63643c85d4c47512decc16f35124160629c39a86.tar.xz
glibc-63643c85d4c47512decc16f35124160629c39a86.zip
Hurd: hurdsock: reject negative domains
-rw-r--r--ChangeLog5
-rw-r--r--hurd/hurdsock.c8
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f59a1ee09..b1dbcba197 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-10  Pino Toscano  <toscano.pino@tiscali.it>
+
+	* hurd/hurdsock.c (_hurd_socket_server): Check for negative domains,
+	and reject them.
+
 2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
 
 	* sysdeps/mach/hurd/setresgid.c (__setresgid): Handle the -1 case,
diff --git a/hurd/hurdsock.c b/hurd/hurdsock.c
index f3611ecf27..4b32ad4314 100644
--- a/hurd/hurdsock.c
+++ b/hurd/hurdsock.c
@@ -1,5 +1,5 @@
 /* _hurd_socket_server - Find the server for a socket domain.
-   Copyright (C) 1991,92,93,94,95,97,99 Free Software Foundation, Inc.
+   Copyright (C) 1991-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
@@ -46,6 +46,12 @@ _hurd_socket_server (int domain, int dead)
 {
   socket_t server;
 
+  if (domain < 0)
+    {
+      errno = EAFNOSUPPORT;
+      return MACH_PORT_NULL;
+    }
+
   HURD_CRITICAL_BEGIN;
   __mutex_lock (&lock);