Skip to content

Commit ce61b60

Browse files
namjaejeonsmfrench
authored andcommitted
ksmbd: the buffer of smb2 query dir response has at least 1 byte
When STATUS_NO_MORE_FILES status is set to smb2 query dir response, ->StructureSize is set to 9, which mean buffer has 1 byte. This issue occurs because ->Buffer[1] in smb2_query_directory_rsp to flex-array. Fixes: eb3e28c ("smb3: Replace smb2pdu 1-element arrays with flex-arrays") Cc: [email protected] # v6.1+ Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent b311c1b commit ce61b60

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/smb/server/smb2pdu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4409,7 +4409,8 @@ int smb2_query_dir(struct ksmbd_work *work)
44094409
rsp->OutputBufferLength = cpu_to_le32(0);
44104410
rsp->Buffer[0] = 0;
44114411
rc = ksmbd_iov_pin_rsp(work, (void *)rsp,
4412-
sizeof(struct smb2_query_directory_rsp));
4412+
offsetof(struct smb2_query_directory_rsp, Buffer)
4413+
+ 1);
44134414
if (rc)
44144415
goto err_out;
44154416
} else {

0 commit comments

Comments
 (0)