Skip to content

Commit 860ca5e

Browse files
Haoxiang LiSteve French
authored andcommitted
smb: client: Add check for next_buffer in receive_encrypted_standard()
Add check for the return value of cifs_buf_get() and cifs_small_buf_get() in receive_encrypted_standard() to prevent null pointer dereference. Fixes: eec04ea ("smb: client: fix OOB in receive_encrypted_standard()") Cc: [email protected] Signed-off-by: Haoxiang Li <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent e9a8cac commit 860ca5e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/smb/client/smb2ops.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4965,6 +4965,10 @@ receive_encrypted_standard(struct TCP_Server_Info *server,
49654965
next_buffer = (char *)cifs_buf_get();
49664966
else
49674967
next_buffer = (char *)cifs_small_buf_get();
4968+
if (!next_buffer) {
4969+
cifs_server_dbg(VFS, "No memory for (large) SMB response\n");
4970+
return -1;
4971+
}
49684972
memcpy(next_buffer, buf + next_cmd, pdu_length - next_cmd);
49694973
}
49704974

0 commit comments

Comments
 (0)