From 18bd1f75d4f03e755020151925e08ebac3866d0c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Aug 2023 10:52:31 -0700 Subject: [PATCH] s3: smbd: Ensure all callers to srvstr_pull_req_talloc() pass a zeroed-out dest pointer. Now we've fixed srvstr_pull_req_talloc() this isn't strictly needed, but ensuring pointers are initialized is best practice to avoid future bugs. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15420 Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Mon Aug 14 15:55:43 UTC 2023 on atb-devel-224 (cherry picked from commit 5379b8d557a9a16b81eafb87b60b81debc4bfccb) --- source3/smbd/smb1_ipc.c | 2 +- source3/smbd/smb1_message.c | 2 +- source3/smbd/smb1_sesssetup.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/smbd/smb1_ipc.c b/source3/smbd/smb1_ipc.c index 3f9958fece0..716b67b40ea 100644 --- a/source3/smbd/smb1_ipc.c +++ b/source3/smbd/smb1_ipc.c @@ -695,7 +695,7 @@ void reply_trans(struct smb_request *req) return; } - if ((state = talloc(conn, struct trans_state)) == NULL) { + if ((state = talloc_zero(conn, struct trans_state)) == NULL) { DEBUG(0, ("talloc failed\n")); reply_nterror(req, NT_STATUS_NO_MEMORY); END_PROFILE(SMBtrans); diff --git a/source3/smbd/smb1_message.c b/source3/smbd/smb1_message.c index 928be77f854..ca7201e2e7f 100644 --- a/source3/smbd/smb1_message.c +++ b/source3/smbd/smb1_message.c @@ -159,7 +159,7 @@ void reply_sends(struct smb_request *req) return; } - state = talloc(talloc_tos(), struct msg_state); + state = talloc_zero(talloc_tos(), struct msg_state); p = req->buf + 1; p += srvstr_pull_req_talloc( diff --git a/source3/smbd/smb1_sesssetup.c b/source3/smbd/smb1_sesssetup.c index e0c601c34c7..6c668fffa7b 100644 --- a/source3/smbd/smb1_sesssetup.c +++ b/source3/smbd/smb1_sesssetup.c @@ -86,7 +86,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req) DATA_BLOB in_blob; DATA_BLOB out_blob = data_blob_null; size_t bufrem; - char *tmp; + char *tmp = NULL; const char *native_os; const char *native_lanman; const char *primary_domain; -- 2.11.4.GIT