summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2017-02-17 10:08:17 +0100
committerJeremy Allison <jra@samba.org>2017-02-23 03:18:10 +0100
commit9297ac44f7e0455bb74ee77ad8b68f2e8c4a070d (patch)
treec623eedbcacf0f46e5a41499e3c3c67da8301e9c /source3/lib
parent13690569ee5893e3dbd96f2b28a41a35e3da42ff (diff)
downloadsamba-9297ac44f7e0455bb74ee77ad8b68f2e8c4a070d.tar.gz
s3:lib: Do not segfault if username is NULL
Found by covscan. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12592 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_cmdline.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source3/lib/util_cmdline.c b/source3/lib/util_cmdline.c
index 6c98b44ebd2..ad51a4f5217 100644
--- a/source3/lib/util_cmdline.c
+++ b/source3/lib/util_cmdline.c
@@ -112,11 +112,14 @@ void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
{
const char *new_val = NULL;
+ if (username == NULL) {
+ return;
+ }
cli_credentials_parse_string(auth_info->creds,
username,
CRED_SPECIFIED);
new_val = cli_credentials_get_username(auth_info->creds);
- if (username != NULL && new_val == NULL) {
+ if (new_val == NULL) {
exit(ENOMEM);
}