aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-01-31 03:52:01 -0500
committerSteve French <smfrench@gmail.com>2012-01-31 08:42:06 -0500
commit4991a5faab7368daac463181e786608b4eb63675 (patch)
treede09a9fbbfae716c5dc2cb57a1f83a0460a8c8f4 /fs
parent803ab977618eae2b292cda0a97eed75f42250ddf (diff)
cifs: check offset in decode_ntlmssp_challenge()
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/sess.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index d85efad5765f..eb767412177d 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -395,6 +395,10 @@ static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
395 ses->ntlmssp->server_flags = le32_to_cpu(pblob->NegotiateFlags); 395 ses->ntlmssp->server_flags = le32_to_cpu(pblob->NegotiateFlags);
396 tioffset = le32_to_cpu(pblob->TargetInfoArray.BufferOffset); 396 tioffset = le32_to_cpu(pblob->TargetInfoArray.BufferOffset);
397 tilen = le16_to_cpu(pblob->TargetInfoArray.Length); 397 tilen = le16_to_cpu(pblob->TargetInfoArray.Length);
398 if (tioffset > blob_len || tioffset + tilen > blob_len) {
399 cERROR(1, "tioffset + tilen too high %u + %u", tioffset, tilen);
400 return -EINVAL;
401 }
398 if (tilen) { 402 if (tilen) {
399 ses->auth_key.response = kmalloc(tilen, GFP_KERNEL); 403 ses->auth_key.response = kmalloc(tilen, GFP_KERNEL);
400 if (!ses->auth_key.response) { 404 if (!ses->auth_key.response) {