Skip to content

Commit

Permalink
cifs: check offset in decode_ntlmssp_challenge()
Browse files Browse the repository at this point in the history
We should check that we're not copying memory from beyond the end of the
blob.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
  • Loading branch information
Dan Carpenter authored and Steve French committed Jan 31, 2012
1 parent 803ab97 commit 4991a5f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/cifs/sess.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,10 @@ static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
ses->ntlmssp->server_flags = le32_to_cpu(pblob->NegotiateFlags);
tioffset = le32_to_cpu(pblob->TargetInfoArray.BufferOffset);
tilen = le16_to_cpu(pblob->TargetInfoArray.Length);
if (tioffset > blob_len || tioffset + tilen > blob_len) {
cERROR(1, "tioffset + tilen too high %u + %u", tioffset, tilen);
return -EINVAL;
}
if (tilen) {
ses->auth_key.response = kmalloc(tilen, GFP_KERNEL);
if (!ses->auth_key.response) {
Expand Down

0 comments on commit 4991a5f

Please sign in to comment.