From 80347b382bafa8b20c5e688f637108d315cce99f Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Fri, 20 Dec 2024 06:44:03 +1000 Subject: [PATCH] ensure we have a username when connecting a share Signed-off-by: Ronnie Sahlberg --- lib/libsmb2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libsmb2.c b/lib/libsmb2.c index 928af5d2..606d7674 100644 --- a/lib/libsmb2.c +++ b/lib/libsmb2.c @@ -1082,6 +1082,10 @@ smb2_connect_share_async(struct smb2_context *smb2, smb2_set_error(smb2, "Failed to strdup(share)"); return -ENOMEM; } + if (smb2->user == NULL) { + smb2_set_error(smb2, "smb2->user is NULL"); + return -ENOMEM; + } c_data->user = strdup(smb2->user); if (c_data->user == NULL) { free_c_data(smb2, c_data);