Patchwork [maverick,maverick/ti-omap4,CVE,3/3] cifs: check for NULL session password

login
register
mail settings
Submitter Andy Whitcroft
Date Oct. 25, 2011, 4:12 p.m.
Message ID <1319559148-30401-8-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/121732/
State New
Headers show

Comments

Andy Whitcroft - Oct. 25, 2011, 4:12 p.m.
From: Jeff Layton <jlayton@redhat.com>

It's possible for a cifsSesInfo struct to have a NULL password, so we
need to check for that prior to running strncmp on it.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>

(cherry picked from commit 24e6cf92fde1f140d8eb0bf7cd24c2c78149b6b2)
CVE-2011-1585
BugLink: http://bugs.launchpad.net/bugs/869208
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 fs/cifs/connect.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Patch

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 3cc37e0..5d83038 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1608,6 +1608,7 @@  cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
 				    MAX_USERNAME_SIZE))
 				continue;
 			if (strlen(vol->username) != 0 &&
+			    ses->password != NULL &&
 			    strncmp(ses->password,
 				    vol->password ? vol->password : "",
 				    MAX_PASSWORD_SIZE))