From: Vsevolod Stakhov Date: Tue, 27 Aug 2019 14:46:47 +0000 (+0100) Subject: [Fix] Fix read-after-end in quoted printable decoding X-Git-Tag: 2.0~334 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b8e311739520ed266a02bc02bccd3fbcdf4dc131;p=rspamd.git [Fix] Fix read-after-end in quoted printable decoding --- 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++;