Skip to content

Commit a9b0b4b

Browse files
Haoxiang Ligregkh
authored andcommitted
smb: client: Add check for next_buffer in receive_encrypted_standard()
commit 860ca5e upstream. 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: stable@vger.kernel.org Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ada54b2 commit a9b0b4b

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
@@ -4991,6 +4991,10 @@ receive_encrypted_standard(struct TCP_Server_Info *server,
49914991
next_buffer = (char *)cifs_buf_get();
49924992
else
49934993
next_buffer = (char *)cifs_small_buf_get();
4994+
if (!next_buffer) {
4995+
cifs_server_dbg(VFS, "No memory for (large) SMB response\n");
4996+
return -1;
4997+
}
49944998
memcpy(next_buffer, buf + next_cmd, pdu_length - next_cmd);
49954999
}
49965000

0 commit comments

Comments
 (0)