]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Revert "smbd: Fix CID 1504457 Resource leak"
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 5 Oct 2023 22:55:46 +0000 (11:55 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 13 Oct 2023 02:18:31 +0000 (02:18 +0000)
We cannot free ‘enc’ — it may be a copy of ‘buffer’, in which parameter
both construct_reply_chain() and smb_request_done() pass arrays of
automatic storage duration!

Fixes CID 1505354.

This reverts commit a395f752f0748751d4ade533c41066903f26c2dd.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/smbd/smb1_process.c

index b775a3691f32ad4d930453a1e2f59036d7de0fdc..e4f6cdf457819f499bc320bda899a7cad2ff1d4a 100644 (file)
@@ -239,17 +239,14 @@ bool smb1_srv_send(struct smbXsrv_connection *xconn,
        }
 
        if (do_encrypt) {
-               char *enc = NULL;
-               NTSTATUS status = srv_encrypt_buffer(xconn, buffer, &enc);
+               NTSTATUS status = srv_encrypt_buffer(xconn, buffer, &buf_out);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0, ("send_smb: SMB encryption failed "
                                "on outgoing packet! Error %s\n",
                                nt_errstr(status) ));
-                       SAFE_FREE(enc);
                        ret = -1;
                        goto out;
                }
-               buf_out = enc;
        }
 
        len = smb_len_large(buf_out) + 4;