part->parsed_data.len = parsed->len;
}
else {
- msg_err_task ("invalid quoted-printable encoded part, assume 8bit");
+ msg_err_task ("invalid uuencoding in encoded part, assume 8bit");
part->ct->flags |= RSPAMD_CONTENT_TYPE_BROKEN;
part->cte = RSPAMD_CTE_8BIT;
- memcpy (parsed->str, part->raw_data.begin, part->raw_data.len);
- parsed->len = part->raw_data.len;
+ parsed->len = MIN (part->raw_data.len, parsed->allocated);
+ memcpy (parsed->str, part->raw_data.begin, parsed->len);
part->parsed_data.begin = parsed->str;
part->parsed_data.len = parsed->len;
}
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 */
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)