commit b8e3117: [Fix] Fix read-after-end in quoted printable decoding

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Aug 27 17:49:08 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-08-27 15:46:47 +0100
URL: https://github.com/rspamd/rspamd/commit/b8e311739520ed266a02bc02bccd3fbcdf4dc131

[Fix] Fix read-after-end in quoted printable decoding

---
 src/libutil/str_util.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c
index 89d94992b..91199aec1 100644
--- a/src/libutil/str_util.c
+++ b/src/libutil/str_util.c
@@ -2081,15 +2081,18 @@ rspamd_decode_qp_buf (const gchar *in, gsize inlen,
 
 	while (remain > 0 && o < end) {
 		if (*p == '=') {
-			p ++;
 			remain --;
 
 			if (remain == 0) {
+				/* Last '=' character, bugon */
 				if (end - o > 0) {
 					*o++ = *p;
-					break;
 				}
+
+				break;
 			}
+
+			p ++;
 decode:
 			/* Decode character after '=' */
 			c = *p++;


More information about the Commits mailing list