summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-01-15 17:33:24 -0800
committerJeremy Allison <jra@samba.org>2010-01-15 17:33:24 -0800
commitf85b6ee90b88c7f7b2a92c8a5f3e2ebe59c1087b (patch)
treeabdb5a6164e78d384f60ef2233e42922a2275553 /source3
parent2d41b1ab78639abe4ae030ff482573f464564dd7 (diff)
downloadsamba-f85b6ee90b88c7f7b2a92c8a5f3e2ebe59c1087b.tar.gz
samba-f85b6ee90b88c7f7b2a92c8a5f3e2ebe59c1087b.tar.bz2
samba-f85b6ee90b88c7f7b2a92c8a5f3e2ebe59c1087b.zip
Second part of bug 7045 - Bad (non memory copying) interfaces in smbc_setXXXX calls.
Protect against SMB_STRDUP of null... Jeremy.
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/libsmb_setget.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source3/libsmb/libsmb_setget.c b/source3/libsmb/libsmb_setget.c
index 3ef707863f..791b4cd9e4 100644
--- a/source3/libsmb/libsmb_setget.c
+++ b/source3/libsmb/libsmb_setget.c
@@ -40,7 +40,9 @@ void
smbc_setNetbiosName(SMBCCTX *c, char * netbios_name)
{
SAFE_FREE(c->netbios_name);
- c->netbios_name = SMB_STRDUP(netbios_name);
+ if (netbios_name) {
+ c->netbios_name = SMB_STRDUP(netbios_name);
+ }
}
/** Get the workgroup used for making connections */
@@ -55,7 +57,9 @@ void
smbc_setWorkgroup(SMBCCTX *c, char * workgroup)
{
SAFE_FREE(c->workgroup);
- c->workgroup = SMB_STRDUP(workgroup);
+ if (workgroup) {
+ c->workgroup = SMB_STRDUP(workgroup);
+ }
}
/** Get the username used for making connections */
@@ -70,7 +74,9 @@ void
smbc_setUser(SMBCCTX *c, char * user)
{
SAFE_FREE(c->user);
- c->user = SMB_STRDUP(user);
+ if (user) {
+ c->user = SMB_STRDUP(user);
+ }
}
/** Get the debug level */