}
}
+
/* Convert raw headers to a list of struct raw_header * */
void
rspamd_mime_headers_process (struct rspamd_task *task, GHashTable *target,
sizeof (struct rspamd_mime_header));
l = p - c;
tmp = rspamd_mempool_alloc (task->task_pool, l + 1);
- rspamd_strlcpy (tmp, c, l + 1);
+ rspamd_null_safe_copy (c, l, tmp, l + 1);
nh->name = tmp;
nh->empty_separator = TRUE;
nh->raw_value = c;
l = p - c;
if (l > 0) {
tmp = rspamd_mempool_alloc (task->task_pool, l + 1);
- rspamd_strlcpy (tmp, c, l + 1);
+ rspamd_null_safe_copy (c, l, tmp, l + 1);
nh->separator = tmp;
}
next_state = 3;
l = p - c;
if (l >= 0) {
tmp = rspamd_mempool_alloc (task->task_pool, l + 1);
- rspamd_strlcpy (tmp, c, l + 1);
+ rspamd_null_safe_copy (c, l, tmp, l + 1);
nh->separator = tmp;
}
c = p;
break;
case 4:
/* Copy header's value */
+
+ /*
+ * XXX:
+ * The original decision to use here null terminated
+ * strings was extremely poor!
+ */
l = p - c;
tmp = rspamd_mempool_alloc (task->task_pool, l + 1);
tp = tmp;
*tp++ = ' ';
}
else {
- *tp++ = *c++;
+ if (*c != '\0') {
+ *tp++ = *c++;
+ }
+ else {
+ c++;
+ }
}
}
else if (t_state == 1) {
}
else {
t_state = 0;
- *tp++ = *c++;
+ if (*c != '\0') {
+ *tp++ = *c++;
+ }
+ else {
+ c++;
+ }
}
}
}