Blame SOURCES/dovecot-2.2.36-cve2019_11500_part2of4.patch

158b54
From a56b0636b1bf9c7677c6fca9681f48752af700a1 Mon Sep 17 00:00:00 2001
158b54
From: Timo Sirainen <timo.sirainen@open-xchange.com>
158b54
Date: Fri, 17 May 2019 10:33:53 +0300
158b54
Subject: [PATCH 2/2] lib-imap: Make sure str_unescape() won't be writing past
158b54
 allocated memory
158b54
158b54
The previous commit should already prevent this, but this makes sure it
158b54
can't become broken in the future either. It makes the performance a tiny
158b54
bit worse, but that's not practically noticeable.
158b54
---
158b54
 src/lib-imap/imap-parser.c | 6 ++----
158b54
 1 file changed, 2 insertions(+), 4 deletions(-)
158b54
158b54
diff --git a/src/lib-imap/imap-parser.c b/src/lib-imap/imap-parser.c
158b54
index f41668d7a..7f58d99e2 100644
158b54
--- a/src/lib-imap/imap-parser.c
158b54
+++ b/src/lib-imap/imap-parser.c
158b54
@@ -267,10 +267,8 @@ static void imap_parser_save_arg(struct imap_parser *parser,
158b54
 
158b54
 		/* remove the escapes */
158b54
 		if (parser->str_first_escape >= 0 &&
158b54
-		    (parser->flags & IMAP_PARSE_FLAG_NO_UNESCAPE) == 0) {
158b54
-			/* -1 because we skipped the '"' prefix */
158b54
-			(void)str_unescape(str + parser->str_first_escape-1);
158b54
-		}
158b54
+		    (parser->flags & IMAP_PARSE_FLAG_NO_UNESCAPE) == 0)
158b54
+			(void)str_unescape(str);
158b54
 		arg->_data.str = str;
158b54
 		arg->str_len = strlen(str);
158b54
 		break;
158b54
-- 
158b54
2.11.0
158b54