summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2016-06-07 10:07:21 +0200
committerVolker Lendecke <vl@samba.org>2016-06-07 18:31:30 +0200
commit08a78662e9406fbc23db059f30b4e55392ee7332 (patch)
tree3a3a2269033f5872a539ac079e1fe7ab2b15d8d2 /source3/libsmb
parentf5e95af59b76f3aa0d428fbf2f5cc5e65f6cd409 (diff)
downloadsamba-08a78662e9406fbc23db059f30b4e55392ee7332.tar.gz
libsmb: Fix two CIDs for NULL dereference
This whole area is a known-to-be-broken mess, but this patch should fix the immediate crash Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Jun 7 18:31:30 CEST 2016 on sn-devel-144
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/libsmb_server.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 06c0211fa67..eb4d5d2963f 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -121,14 +121,20 @@ SMBC_call_auth_fn(TALLOC_CTX *ctx,
char **pp_username,
char **pp_password)
{
- fstring workgroup;
- fstring username;
- fstring password;
+ fstring workgroup = { 0 };
+ fstring username = { 0 };
+ fstring password = { 0 };
smbc_get_auth_data_with_context_fn auth_with_context_fn;
- strlcpy(workgroup, *pp_workgroup, sizeof(workgroup));
- strlcpy(username, *pp_username, sizeof(username));
- strlcpy(password, *pp_password, sizeof(password));
+ if (*pp_workgroup != NULL) {
+ strlcpy(workgroup, *pp_workgroup, sizeof(workgroup));
+ }
+ if (*pp_username != NULL) {
+ strlcpy(username, *pp_username, sizeof(username));
+ }
+ if (*pp_password != NULL) {
+ strlcpy(password, *pp_password, sizeof(password));
+ }
/* See if there's an authentication with context function provided */
auth_with_context_fn = smbc_getFunctionAuthDataWithContext(context);