Skip to content

Commit

Permalink
cifs: fix NULL pointer dereference in cifs_find_smb_ses
Browse files Browse the repository at this point in the history
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: diabel <gacek-2004@wp.pl>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
  • Loading branch information
Jeff Layton authored and Steve French committed Aug 18, 2010
1 parent 232341b commit fc87a40
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1673,7 +1673,8 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
MAX_USERNAME_SIZE))
continue;
if (strlen(vol->username) != 0 &&
strncmp(ses->password, vol->password,
strncmp(ses->password,
vol->password ? vol->password : "",
MAX_PASSWORD_SIZE))
continue;
}
Expand Down

0 comments on commit fc87a40

Please sign in to comment.