Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc87a406 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French
Browse files

cifs: fix NULL pointer dereference in cifs_find_smb_ses



cifs_find_smb_ses assumes that the vol->password field is a valid
pointer, but that's only the case if a password was passed in via
the options string. It's possible that one won't be if there is
no mount helper on the box.

Reported-by: default avatardiabel <gacek-2004@wp.pl>
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 232341ba
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1673,7 +1673,8 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
				    MAX_USERNAME_SIZE))
				    MAX_USERNAME_SIZE))
				continue;
				continue;
			if (strlen(vol->username) != 0 &&
			if (strlen(vol->username) != 0 &&
			    strncmp(ses->password, vol->password,
			    strncmp(ses->password,
				    vol->password ? vol->password : "",
				    MAX_PASSWORD_SIZE))
				    MAX_PASSWORD_SIZE))
				continue;
				continue;
		}
		}