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

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