summaryrefslogtreecommitdiff
path: root/fs/cifs/sess.c
diff options
context:
space:
mode:
authorShirish Pargaonkar <shirishpargaonkar@gmail.com>2012-02-02 15:28:28 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-02-13 11:16:58 -0800
commit85f2f3e05e8e0deec4fc8b751324f91acb276d21 (patch)
tree6e757d3e8d74ff114f0bc2e24dd855d30f561a38 /fs/cifs/sess.c
parent38c8c07ac7383692d0a4f932f6ac611437ed24ed (diff)
downloadkernel-common-85f2f3e05e8e0deec4fc8b751324f91acb276d21.tar.gz
kernel-common-85f2f3e05e8e0deec4fc8b751324f91acb276d21.tar.bz2
kernel-common-85f2f3e05e8e0deec4fc8b751324f91acb276d21.zip
cifs: Fix oops in session setup code for null user mounts
commit de47a4176c532ef5961b8a46a2d541a3517412d3 upstream. For null user mounts, do not invoke string length function during session setup. Reported-and-Tested-by: Chris Clayton <chris2553@googlemail.com> Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Steve French <smfrench@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/cifs/sess.c')
-rw-r--r--fs/cifs/sess.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 4ec3ee9d72cc..250480917aa5 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -246,16 +246,15 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses,
/* copy user */
/* BB what about null user mounts - check that we do this BB */
/* copy user */
- if (ses->user_name != NULL)
+ if (ses->user_name != NULL) {
strncpy(bcc_ptr, ses->user_name, MAX_USERNAME_SIZE);
+ bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE);
+ }
/* else null user mount */
-
- bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE);
*bcc_ptr = 0;
bcc_ptr++; /* account for null termination */
/* copy domain */
-
if (ses->domainName != NULL) {
strncpy(bcc_ptr, ses->domainName, 256);
bcc_ptr += strnlen(ses->domainName, 256);