Blame SOURCES/dovecot-2.2.36-cve2019_11500_part3of4.patch

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