socket_wrapper: make sure interfaces are in the valid range on bind()
authorStefan Metzmacher <metze@samba.org>
Sun, 10 Jul 2011 14:40:37 +0000 (16:40 +0200)
committerStefan Metzmacher <metze@samba.org>
Sun, 10 Jul 2011 16:24:14 +0000 (18:24 +0200)
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Sun Jul 10 18:24:14 CEST 2011 on sn-devel-104

lib/socket_wrapper/socket_wrapper.c

index d70459ba0871e424fff9fef24a83181c5601c416..2b526262bd78f26aee0ed7cb3534fd9e12ae696f 100644 (file)
@@ -554,6 +554,11 @@ static int convert_in_un_alloc(struct socket_info *si, const struct sockaddr *in
 
        if (bcast) *bcast = is_bcast;
 
+       if (iface == 0 || iface > MAX_WRAPPED_INTERFACES) {
+               errno = EINVAL;
+               return -1;
+       }
+
        if (prt == 0) {
                /* handle auto-allocation of ephemeral ports */
                for (prt = 5001; prt < 10000; prt++) {