hurdsock: reject negative domains Reject negative socket domains right away; otherwise, it is possible to read and set out-of-bounds locations of the `servers' array (returning the values at those invalid memory locations), and even try to deallocate ports with random values if the `dead' parameter is different than zero. 2011-11-21 Pino Toscano * hurd/hurdsock.c (_hurd_socket_server): Check for negative domains, and reject them. --- a/hurd/hurdsock.c +++ b/hurd/hurdsock.c @@ -47,6 +47,12 @@ _hurd_socket_server (int domain, int dea { socket_t server; + if (domain < 0) + { + errno = EAFNOSUPPORT; + return MACH_PORT_NULL; + } + HURD_CRITICAL_BEGIN; __mutex_lock (&lock);