From b8e311739520ed266a02bc02bccd3fbcdf4dc131 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 27 Aug 2019 15:46:47 +0100 Subject: [PATCH] [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++; -- 2.39.5