next_state = parse_param_name;
pname_start = NULL;
pname_end = NULL;
- } else {
+ }
+ else if (*p == ';') {
+ if (pname_start && pname_end && pname_end > pname_start) {
+ rspamd_content_type_add_param (pool, &val, pname_start,
+ pname_end, c, p);
+ }
+
+ p ++;
+ state = parse_space;
+ next_state = parse_param_name;
+ pname_start = NULL;
+ pname_end = NULL;
+ }
+ else {
p++;
}
break;
break;
case parse_param_value:
if (pname_start && pname_end && pname_end > pname_start) {
+ if (p > c && *(p - 1) == ';') {
+ p --;
+ }
+
rspamd_content_type_add_param (pool, &val, pname_start,
pname_end, c, p);
const gchar *start;
const gchar *pos;
const gchar *end;
+ struct rspamd_task *task;
};
static gboolean
if (cur->start >= multipart->raw_data.begin - st->start) {
if (cb->cur_boundary) {
/* Check boundary */
- msg_debug_mime ("compare %L and %L", cb->bhash, cur->hash);
+ msg_debug_mime ("compare %L and %L (and %L)",
+ cb->bhash, cur->hash, cur->closed_hash);
if (cb->bhash == cur->hash) {
sel = i;
gboolean closing = FALSE;
struct rspamd_mime_boundary b;
struct rspamd_mime_parser_ctx *st = context;
+ struct rspamd_task *task;
+
+ task = st->task;
if (G_LIKELY (p < end)) {
blen = rspamd_memcspn (p, "\r\n", end - p);
rspamd_cryptobox_siphash ((guchar *)&b.hash, lc_copy, blen,
lib_ctx->hkey);
+ msg_debug_mime ("normal hash: %*s -> %L", blen, lc_copy);
if (closing) {
b.flags = RSPAMD_MIME_BOUNDARY_FLAG_CLOSED;
rspamd_cryptobox_siphash ((guchar *)&b.closed_hash, lc_copy,
blen + 2,
lib_ctx->hkey);
+ msg_debug_mime ("closing hash: %*s -> %L", blen + 2, lc_copy);
}
else {
b.flags = 0;
nst->start = part->parsed_data.begin;
nst->end = nst->start + part->parsed_data.len;
nst->pos = nst->start;
+ nst->task = st->task;
str.str = (gchar *)part->parsed_data.begin;
str.len = part->parsed_data.len;
st->end = task->msg.begin + task->msg.len;
st->boundaries = g_array_sized_new (FALSE, FALSE,
sizeof (struct rspamd_mime_boundary), 8);
+ st->task = task;
if (st->pos == NULL) {
st->pos = task->msg.begin;