s3:smbd: introduce a body_size variable in smbd_smb2_request_read_done
authorStefan Metzmacher <metze@samba.org>
Mon, 5 Jul 2021 15:49:00 +0000 (17:49 +0200)
committerJule Anger <janger@samba.org>
Thu, 12 Aug 2021 08:41:09 +0000 (08:41 +0000)
This will simplify the following changes.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14607

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 5ecac656fde4e81aa6e51e7b3134ea3fb75f564a)

source3/smbd/smb2_read.c

index cd590a52c9515ce614e1d9bd9def57dcbeeeabc2..8372188f58d7b3c87aa05a5973cb4710b5552454 100644 (file)
@@ -116,6 +116,7 @@ static void smbd_smb2_request_read_done(struct tevent_req *subreq)
 {
        struct smbd_smb2_request *req = tevent_req_callback_data(subreq,
                                        struct smbd_smb2_request);
+       uint16_t body_size;
        DATA_BLOB outbody;
        DATA_BLOB outdyn;
        uint8_t out_data_offset;
@@ -139,9 +140,10 @@ static void smbd_smb2_request_read_done(struct tevent_req *subreq)
                return;
        }
 
-       out_data_offset = SMB2_HDR_BODY + 0x10;
+       body_size = 0x10;
+       out_data_offset = SMB2_HDR_BODY + body_size;
 
-       outbody = smbd_smb2_generate_outbody(req, 0x10);
+       outbody = smbd_smb2_generate_outbody(req, body_size);
        if (outbody.data == NULL) {
                error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
                if (!NT_STATUS_IS_OK(error)) {