guint nlen;
elt = g_slice_alloc (sizeof (*elt));
- memcpy (elt, addr, sizeof (*addr));
+
+ if (addr != NULL) {
+ memcpy (elt, addr, sizeof (*addr));
+ }
+ else {
+ elt->addr = "";
+ elt->domain = "";
+ elt->raw = "<>";
+ elt->raw_len = 2;
+ elt->user = "";
+ elt->flags |= RSPAMD_EMAIL_ADDR_EMPTY;
+ }
if ((elt->flags & RSPAMD_EMAIL_ADDR_QUOTED) && elt->addr[0] == '"') {
if (elt->flags & RSPAMD_EMAIL_ADDR_HAS_BACKSLASH) {
/* Handle leftover */
switch (state) {
case parse_name:
+ /* Assume the whole header as name (bad thing) */
+ if (p > c) {
+ while (p > c && g_ascii_isspace (*p)) {
+ p --;
+ }
+
+ g_string_append_len (ns, c, p - c + 1);
+ rspamd_email_address_add (pool, res, NULL, ns);
+ }
+ break;
case parse_addr:
if (p > c) {
rspamd_smtp_addr_parse (c, p - c, &addr);