Blame SOURCES/autofs-5.1.0-fix-config-entry-read-buffer-not-checked.patch

304803
autofs-5.1.0 - fix config entry read buffer not checked
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
Check the length of config file line read in and report truncation
304803
if it was too long.
304803
---
304803
 CHANGELOG      |    1 +
304803
 lib/defaults.c |    8 +++++++-
304803
 2 files changed, 8 insertions(+), 1 deletion(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -131,6 +131,7 @@
304803
 - fix incorrect round robin host detection.
304803
 - fix race accessing qdn in get_query_dn().
304803
 - fix leak in cache_push_mapent().
304803
+- fix config entry read buffer not checked.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/lib/defaults.c
304803
+++ autofs-5.0.7/lib/defaults.c
304803
@@ -834,7 +834,7 @@ static int parse_line(char *line, char *
304803
 
304803
 static int read_config(unsigned int to_syslog, FILE *f, const char *name)
304803
 {
304803
-	char buf[MAX_LINE_LEN];
304803
+	char buf[MAX_LINE_LEN + 2];
304803
 	char secbuf[MAX_SECTION_NAME];
304803
 	char *new_sec;
304803
 	char *res;
304803
@@ -842,6 +842,12 @@ static int read_config(unsigned int to_s
304803
 	new_sec = NULL;
304803
 	while ((res = fgets(buf, MAX_LINE_LEN, f))) {
304803
 		char *sec, *key, *value;
304803
+
304803
+		if (strlen(res) > MAX_LINE_LEN) {
304803
+			message(to_syslog, "%s was truncated, ignored", res);
304803
+			continue;
304803
+		}
304803
+
304803
 		sec = key = value = NULL;
304803
 		if (!parse_line(res, &sec, &key, &value))
304803
 			continue;