Blame SOURCES/autofs-5.0.7-add-null-check-in-parse_server_string.patch

ab3a3d
autofs-5.0.7 - add null check in parse_server_string()
ab3a3d
ab3a3d
From: Ian Kent <raven@themaw.net>
ab3a3d
ab3a3d
Add an error check for the case there's no ':' server name delimiter in
ab3a3d
parse_server_string().
ab3a3d
---
ab3a3d
 modules/lookup_ldap.c |    5 +++++
ab3a3d
 1 file changed, 5 insertions(+)
ab3a3d
ab3a3d
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
ab3a3d
index 17cbe9a..a59de92 100644
ab3a3d
--- a/modules/lookup_ldap.c
ab3a3d
+++ b/modules/lookup_ldap.c
ab3a3d
@@ -1212,6 +1212,11 @@ static int parse_server_string(unsigned logopt, const char *url, struct lookup_c
ab3a3d
 		/* Isolate the server. Include the port spec */
ab3a3d
 		if (*ptr != '[')
ab3a3d
 			q = strchr(ptr, ':');
ab3a3d
+			if (!q) {
ab3a3d
+				crit(logopt, MODPREFIX
ab3a3d
+				     "LDAP server name not found in %s", ptr);
ab3a3d
+				return 0;
ab3a3d
+			}
ab3a3d
 		else {
ab3a3d
 			q = ++ptr;
ab3a3d
 			while (*q == ':' || isxdigit(*q))