summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-09-14 11:59:22 -0700
committerJeremy Allison <jra@samba.org>2011-09-14 11:59:22 -0700
commitf261ac1932ecdae925b27301aa3e907757845a85 (patch)
treee5adca27c4ec818af442948e7a0100028594eb6e
parentd727fcc867866127e84f6f997a2b8e132584616c (diff)
downloadsamba-f261ac1932ecdae925b27301aa3e907757845a85.tar.gz
samba-f261ac1932ecdae925b27301aa3e907757845a85.tar.bz2
samba-f261ac1932ecdae925b27301aa3e907757845a85.zip
Fix bug #8453 - smbclient segfaults when dialect option -m is used for legacy dialects
Ensure we have valid pointers.
-rw-r--r--source3/libsmb/cliconnect.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 54cd669c10..5881d0cdb8 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -1997,6 +1997,19 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
}
if (cli_state_protocol(cli) < 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;
}