Commit de47a4176c532ef5961b8a46a2d541a3517412d3
Committed by
Steve French
1 parent
2a73ca8208
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 3 additions and 4 deletions Side-by-side Diff
fs/cifs/sess.c
... | ... | @@ -246,16 +246,15 @@ |
246 | 246 | /* copy user */ |
247 | 247 | /* BB what about null user mounts - check that we do this BB */ |
248 | 248 | /* copy user */ |
249 | - if (ses->user_name != NULL) | |
249 | + if (ses->user_name != NULL) { | |
250 | 250 | strncpy(bcc_ptr, ses->user_name, MAX_USERNAME_SIZE); |
251 | + bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE); | |
252 | + } | |
251 | 253 | /* else null user mount */ |
252 | - | |
253 | - bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE); | |
254 | 254 | *bcc_ptr = 0; |
255 | 255 | bcc_ptr++; /* account for null termination */ |
256 | 256 | |
257 | 257 | /* copy domain */ |
258 | - | |
259 | 258 | if (ses->domainName != NULL) { |
260 | 259 | strncpy(bcc_ptr, ses->domainName, 256); |
261 | 260 | bcc_ptr += strnlen(ses->domainName, 256); |