cifs: Fix oops in session setup code for null user mounts
For null user mounts, do not invoke string length function during session setup. Cc: <stable@kernel.org 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>
This commit is contained in:
parent
2a73ca8208
commit
de47a4176c
@ -246,16 +246,15 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses,
|
|||||||
/* copy user */
|
/* copy user */
|
||||||
/* BB what about null user mounts - check that we do this BB */
|
/* BB what about null user mounts - check that we do this BB */
|
||||||
/* copy user */
|
/* copy user */
|
||||||
if (ses->user_name != NULL)
|
if (ses->user_name != NULL) {
|
||||||
strncpy(bcc_ptr, ses->user_name, MAX_USERNAME_SIZE);
|
strncpy(bcc_ptr, ses->user_name, MAX_USERNAME_SIZE);
|
||||||
|
bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE);
|
||||||
|
}
|
||||||
/* else null user mount */
|
/* else null user mount */
|
||||||
|
|
||||||
bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE);
|
|
||||||
*bcc_ptr = 0;
|
*bcc_ptr = 0;
|
||||||
bcc_ptr++; /* account for null termination */
|
bcc_ptr++; /* account for null termination */
|
||||||
|
|
||||||
/* copy domain */
|
/* copy domain */
|
||||||
|
|
||||||
if (ses->domainName != NULL) {
|
if (ses->domainName != NULL) {
|
||||||
strncpy(bcc_ptr, ses->domainName, 256);
|
strncpy(bcc_ptr, ses->domainName, 256);
|
||||||
bcc_ptr += strnlen(ses->domainName, 256);
|
bcc_ptr += strnlen(ses->domainName, 256);
|
||||||
|
Loading…
Reference in New Issue
Block a user