Skip to content

Commit dbad630

Browse files
namjaejeonsmfrench
authored andcommitted
ksmbd: validate compound response buffer
Add the check to validate compound response buffer. Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 9a63b99 commit dbad630

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,12 @@ bool is_chained_smb2_message(struct ksmbd_work *work)
449449
return false;
450450
}
451451

452+
if ((u64)get_rfc1002_len(work->response_buf) + MAX_CIFS_SMALL_BUFFER_SIZE >
453+
work->response_sz) {
454+
pr_err("next response offset exceeds response buffer size\n");
455+
return false;
456+
}
457+
452458
ksmbd_debug(SMB, "got SMB2 chained command\n");
453459
init_chained_smb2_rsp(work);
454460
return true;

0 commit comments

Comments
 (0)