diff options
author | Jeff Layton <jlayton@redhat.com> | 2011-04-27 13:25:51 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2011-04-29 00:57:39 -0400 |
commit | fcda7f4578bbf9717444ca6da8a421d21489d078 (patch) | |
tree | 5cf2fc99c067eb49f410ad095ca2cabec2fe86ac /fs/cifs/sess.c | |
parent | bfacf2225a955bea9c41c707fc72ba16009674a0 (diff) |
cifs: check for bytes_remaining going to zero in CIFS_SessSetup
It's possible that when we go to decode the string area in the
SESSION_SETUP response, that bytes_remaining will be 0. Decrementing it at
that point will mean that it can go "negative" and wrap. Check for a
bytes_remaining value of 0, and don't try to decode the string area if
that's the case.
Cc: stable@kernel.org
Reported-and-Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/sess.c')
-rw-r--r-- | fs/cifs/sess.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 2e2c91103529..645114ad0a10 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -916,7 +916,9 @@ ssetup_ntlmssp_authenticate: | |||
916 | } | 916 | } |
917 | 917 | ||
918 | /* BB check if Unicode and decode strings */ | 918 | /* BB check if Unicode and decode strings */ |
919 | if (smb_buf->Flags2 & SMBFLG2_UNICODE) { | 919 | if (bytes_remaining == 0) { |
920 | /* no string area to decode, do nothing */ | ||
921 | } else if (smb_buf->Flags2 & SMBFLG2_UNICODE) { | ||
920 | /* unicode string area must be word-aligned */ | 922 | /* unicode string area must be word-aligned */ |
921 | if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) { | 923 | if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) { |
922 | ++bcc_ptr; | 924 | ++bcc_ptr; |