diff options
author | Jeff Layton <jlayton@redhat.com> | 2011-04-27 13:25:51 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-05-23 11:20:14 -0700 |
commit | b3f815365f0bf897ece5d2896cb0534a9b70d28c (patch) | |
tree | 76631b3e293c2063ee4b7d19fa5d1e8bf9a0fef8 /fs | |
parent | 790b1f612de4635baeec28b32d672ab4fb381879 (diff) |
cifs: check for bytes_remaining going to zero in CIFS_SessSetup
commit fcda7f4578bbf9717444ca6da8a421d21489d078 upstream.
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.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-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 6d6ff4fe60e..20ae71ba69e 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -906,7 +906,9 @@ ssetup_ntlmssp_authenticate: } /* BB check if Unicode and decode strings */ - if (smb_buf->Flags2 & SMBFLG2_UNICODE) { + if (bytes_remaining == 0) { + /* no string area to decode, do nothing */ + } else if (smb_buf->Flags2 & SMBFLG2_UNICODE) { /* unicode string area must be word-aligned */ if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) { ++bcc_ptr; |