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

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