librpc: Check for negative return value of socket_get_fd()
authorAndreas Schneider <asn@samba.org>
Wed, 22 Jun 2016 07:25:16 +0000 (09:25 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 22 Jun 2016 17:25:20 +0000 (19:25 +0200)
Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/librpc/rpc/dcerpc_sock.c

index f5a1c07c922516ed22bbb0bddf71dd719083b512..7175eb2e3678ad0e609f15b2653890205e6c41d1 100644 (file)
@@ -72,6 +72,11 @@ static void continue_socket_connect(struct composite_context *ctx)
                return;
        }
        sock_fd = socket_get_fd(s->socket_ctx);
+       if (sock_fd == -1) {
+               TALLOC_FREE(s->socket_ctx);
+               composite_error(c, NT_STATUS_INVALID_HANDLE);
+               return;
+       }
        socket_set_flags(s->socket_ctx, SOCKET_FLAG_NOCLOSE);
        TALLOC_FREE(s->socket_ctx);