Blame SOURCES/dovecot-2.2.36-cve2019_11500_part3of4.patch

c9ace8
From 7ce9990a5e6ba59e89b7fe1c07f574279aed922c Mon Sep 17 00:00:00 2001
c9ace8
From: Timo Sirainen <timo.sirainen@open-xchange.com>
c9ace8
Date: Fri, 10 May 2019 19:43:55 +0300
c9ace8
Subject: [PATCH 1/2] lib-managesieve: Don't accept strings with NULs
c9ace8
c9ace8
ManageSieve doesn't allow NULs in strings.
c9ace8
c9ace8
This fixes a bug with unescaping a string with NULs: str_unescape() could
c9ace8
have been called for memory that points outside the allocated string,
c9ace8
causing heap corruption. This could cause crashes or theoretically even
c9ace8
result in remote code execution exploit.
c9ace8
c9ace8
Found by Nick Roessler and Rafi Rubin
c9ace8
---
c9ace8
 src/lib-managesieve/managesieve-parser.c | 5 +++++
c9ace8
 1 file changed, 5 insertions(+)
c9ace8
c9ace8
diff --git a/src/lib-managesieve/managesieve-parser.c b/src/lib-managesieve/managesieve-parser.c
c9ace8
index d3eb2101..f5f9d323 100644
c9ace8
--- a/src/lib-managesieve/managesieve-parser.c
c9ace8
+++ b/src/lib-managesieve/managesieve-parser.c
c9ace8
@@ -258,6 +258,11 @@ managesieve_parser_read_string(struct managesieve_parser *parser,
c9ace8
 			break;
c9ace8
 		}
c9ace8
 
c9ace8
+		if (data[i] == '\0') {
c9ace8
+			parser->error = "NULs not allowed in strings";
c9ace8
+			return FALSE;
c9ace8
+		}
c9ace8
+
c9ace8
 		if (data[i] == '\\') {
c9ace8
 			if (i+1 == data_size) {
c9ace8
 				/* known data ends with '\' - leave it to
c9ace8
-- 
c9ace8
2.11.0
c9ace8