aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/str_util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-25 17:56:32 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-25 17:56:32 +0100
commit75ad544ef49c646a02b9bddd434eb8d831ca487d (patch)
treeb3b28164e9fdd42c7b2b5b04e1ce2954e7d72b60 /src/libutil/str_util.c
parent053ef54a3da1b6d60cdf50de0cab2faf1cac1a3e (diff)
downloadrspamd-75ad544ef49c646a02b9bddd434eb8d831ca487d.tar.gz
rspamd-75ad544ef49c646a02b9bddd434eb8d831ca487d.zip
[Fix] Uuencode: Fix parsing of corrupted uuencode
Diffstat (limited to 'src/libutil/str_util.c')
-rw-r--r--src/libutil/str_util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c
index 7edb1b109..d1f2cbfe6 100644
--- a/src/libutil/str_util.c
+++ b/src/libutil/str_util.c
@@ -2214,6 +2214,10 @@ rspamd_decode_uue_buf (const gchar *in, gsize inlen,
out_end = out + outlen;
remain = inlen;
+ /* Skip newlines */
+#define SKIP_NEWLINE do { while (remain > 0 && (*p == '\n' || *p == '\r')) {p ++; remain --; } } while (0)
+ SKIP_NEWLINE;
+
/* First of all, we need to read the first line (and probably skip it) */
if (remain < sizeof ("begin-base64 ")) {
/* Obviously truncated */
@@ -2247,7 +2251,6 @@ rspamd_decode_uue_buf (const gchar *in, gsize inlen,
return (-1);
}
-#define SKIP_NEWLINE do { while (remain > 0 && (*p == '\n' || *p == '\r')) {p ++; remain --; } } while (0)
#define DEC(c) (((c) - ' ') & 077) /* single character decode */
#define IS_DEC(c) ( (((c) - ' ') >= 0) && (((c) - ' ') <= 077 + 1) )
#define CHAR_OUT(c) do { if (o < out_end) { *o++ = c; } else { return (-1); } } while(0)