]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Fix bug #8453 - smbclient segfaults when dialect option -m is used for legacy dialects
authorJeremy Allison <jra@samba.org>
Wed, 14 Sep 2011 18:55:16 +0000 (11:55 -0700)
committerKarolin Seeger <kseeger@samba.org>
Wed, 12 Oct 2011 18:54:32 +0000 (20:54 +0200)
Ensure we have valid pointers.
(cherry picked from commit 9bbb3a89ffa39c9be30c269bf96f080866740406)

source3/libsmb/cliconnect.c

index 81c1819964fa4db07c764acafc5c55739c85bfce..113b8a5f14448952b84760c07ae929d36b5cf8ae 100644 (file)
@@ -1997,6 +1997,19 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
        }
 
        if (cli->protocol < PROTOCOL_LANMAN1) {
+               /*
+                * Ensure cli->server_domain,
+                * cli->server_os and cli->server_type
+                * are valid pointers.
+                */
+               cli->server_domain = talloc_strdup(cli, "");
+               cli->server_os = talloc_strdup(cli, "");
+               cli->server_type = talloc_strdup(cli, "");
+               if (cli->server_domain == NULL ||
+                               cli->server_os == NULL ||
+                               cli->server_type == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+               }
                return NT_STATUS_OK;
        }