[PATCH 1/2] mount.cifs: check for NULL pointer before calling strchr()

Jeff Layton <[email protected]>
Newsgroups gmane.linux.file-systems.cifs
Message-ID <[email protected]>
mount.cifs calls strchr on currentaddress, which may be a NULL pointer.

Signed-off-by: Jeff Layton <[email protected]>
---
 mount.cifs.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/mount.cifs.c b/mount.cifs.c
index acab8c8..f3aa464 100644
--- a/mount.cifs.c
+++ b/mount.cifs.c
@@ -1730,9 +1730,11 @@ mount_retry:
 		case ECONNREFUSED:
 		case EHOSTUNREACH:
 			currentaddress = nextaddress;
-			nextaddress = strchr(currentaddress, ',');
-			if (nextaddress)
-				*nextaddress++ = '\0';
+			if (currentaddress) {
+				nextaddress = strchr(currentaddress, ',');
+				if (nextaddress)
+					*nextaddress++ = '\0';
+			}
 			goto mount_retry;
 		case ENODEV:
 			fprintf(stderr,
-- 
1.6.6.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.