s3: libsmb: Protect cli_connect_nb_send() from being passed a NULL hostname and dest_ss.
authorJeremy Allison <jra@samba.org>
Mon, 8 Aug 2016 23:53:21 +0000 (16:53 -0700)
committerUri Simchoni <uri@samba.org>
Wed, 10 Aug 2016 06:18:17 +0000 (08:18 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12135

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/libsmb/cliconnect.c

index ebba8f206e09c923d523f92f32d6ca63c2486650..33759d9d87b52825ee025c1bd8fef088537be6f4 100644 (file)
@@ -3108,11 +3108,15 @@ static struct tevent_req *cli_connect_nb_send(
                }
 
                state->desthost = host;
-       } else {
+       } else if (dest_ss != NULL) {
                state->desthost = print_canonical_sockaddr(state, dest_ss);
                if (tevent_req_nomem(state->desthost, req)) {
                        return tevent_req_post(req, ev);
                }
+       } else {
+               /* No host or dest_ss given. Error out. */
+               tevent_req_error(req, EINVAL);
+               return tevent_req_post(req, ev);
        }
 
        subreq = cli_connect_sock_send(state, ev, host, name_type, dest_ss,