Skip to content

Commit

Permalink
smb: client: Add check for next_buffer in receive_encrypted_standard()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Haoxiang Li authored and Steve French committed Feb 20, 2025
1 parent e9a8cac commit 860ca5e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/smb/client/smb2ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -4965,6 +4965,10 @@ receive_encrypted_standard(struct TCP_Server_Info *server,
next_buffer = (char *)cifs_buf_get();
else
next_buffer = (char *)cifs_small_buf_get();
if (!next_buffer) {
cifs_server_dbg(VFS, "No memory for (large) SMB response\n");
return -1;
}
memcpy(next_buffer, buf + next_cmd, pdu_length - next_cmd);
}

Expand Down

0 comments on commit 860ca5e

Please sign in to comment.