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

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