diff options
author | Jeremy Allison <jra@samba.org> | 2010-01-15 17:22:35 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-01-15 17:22:35 -0800 |
commit | 2d41b1ab78639abe4ae030ff482573f464564dd7 (patch) | |
tree | 8ef39743081f20d0b838d4a92b40531088782a2b /source3/libsmb/libsmb_setget.c | |
parent | a56ede9027125aa9e70358661b2db1e9f993e939 (diff) | |
download | samba-2d41b1ab78639abe4ae030ff482573f464564dd7.tar.gz |
Fix bug 7045 - Bad (non memory copying) interfaces in smbc_setXXXX calls.
In smbc_free_context libsmbclient just called free() on the string options
so it assumes the callers have malloced them before setting them via smbc_set
calls.
Change to corretly malloc/free string options to the library.
Jeremy
Diffstat (limited to 'source3/libsmb/libsmb_setget.c')
-rw-r--r-- | source3/libsmb/libsmb_setget.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source3/libsmb/libsmb_setget.c b/source3/libsmb/libsmb_setget.c index fc3f321497..3ef707863f 100644 --- a/source3/libsmb/libsmb_setget.c +++ b/source3/libsmb/libsmb_setget.c @@ -39,7 +39,8 @@ smbc_getNetbiosName(SMBCCTX *c) void smbc_setNetbiosName(SMBCCTX *c, char * netbios_name) { - c->netbios_name = netbios_name; + SAFE_FREE(c->netbios_name); + c->netbios_name = SMB_STRDUP(netbios_name); } /** Get the workgroup used for making connections */ @@ -53,7 +54,8 @@ smbc_getWorkgroup(SMBCCTX *c) void smbc_setWorkgroup(SMBCCTX *c, char * workgroup) { - c->workgroup = workgroup; + SAFE_FREE(c->workgroup); + c->workgroup = SMB_STRDUP(workgroup); } /** Get the username used for making connections */ @@ -67,7 +69,8 @@ smbc_getUser(SMBCCTX *c) void smbc_setUser(SMBCCTX *c, char * user) { - c->user = user; + SAFE_FREE(c->user); + c->user = SMB_STRDUP(user); } /** Get the debug level */ |