]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix read-after-end in quoted printable decoding
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 27 Aug 2019 14:46:47 +0000 (15:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 27 Aug 2019 15:54:45 +0000 (16:54 +0100)
src/libutil/str_util.c

index 89d94992ba729524cf237be1e40a4e0dd9a7a69f..91199aec10e2cb777a87b3f5a07cab3c5fd7e94a 100644 (file)
@@ -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++;