[<prev] [next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1203012143280.19443@swampdragon.chaosbits.net>
Date: Thu, 1 Mar 2012 21:45:13 +0100 (CET)
From: Jesper Juhl <jj@...osbits.net>
To: linux-cifs@...r.kernel.org
cc: samba-technical@...ts.samba.org, linux-kernel@...r.kernel.org,
Steve French <sfrench@...ba.org>, sfrench@...ibm.com
Subject: [PATCH] cifs: don't dereference potentially NULL variable in
match_session()
This bit of code:
...
if (strncmp(ses->user_name,
vol->username ? vol->username : "",
MAX_USERNAME_SIZE))
return 0;
...
implies that 'vol->username' may be NULL.
If it is NULL, then the 'strlen(vol->username)' that follows will
dereference a NULL pointer.
This patch should take care of that issue.
Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
fs/cifs/connect.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Compile tested only.
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 602f77c..2f3cf02 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2014,8 +2014,9 @@ static int match_session(struct cifs_ses *ses, struct smb_vol *vol)
vol->username ? vol->username : "",
MAX_USERNAME_SIZE))
return 0;
- if (strlen(vol->username) != 0 &&
- ses->password != NULL &&
+ if (vol->username &&
+ strlen(vol->username) != 0 &&
+ ses->password &&
strncmp(ses->password,
vol->password ? vol->password : "",
MAX_PASSWORD_SIZE))
--
1.7.9.2
--
Jesper Juhl <jj@...osbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists