From b137a1b0efdd021d125ead020484892d1313c197 Mon Sep 17 00:00:00 2001 From: SJ Date: Wed, 28 Nov 2012 23:15:14 +0100 Subject: [PATCH] fixing the fromdomain issue --- src/config.h | 2 +- src/parser.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.h b/src/config.h index 877e93ce..769d3cd5 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "0.1.22" -#define BUILD 728 +#define BUILD 729 #define HOSTID "mailarchiver" diff --git a/src/parser.c b/src/parser.c index a7825748..c1a4b0b3 100644 --- a/src/parser.c +++ b/src/parser.c @@ -605,10 +605,10 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int if(state->message_state == MSG_FROM && state->is_1st_header == 1 && strlen(state->b_from) < SMALLBUFSIZE-len-1){ memcpy(&(state->b_from[strlen(state->b_from)]), puf, len); - if(does_it_seem_like_an_email_address(puf) == 1){ + if(does_it_seem_like_an_email_address(puf) == 1 && state->b_from_domain[0] == '\0' && len > 5){ q = strchr(puf, '@'); - if(q){ - memcpy(&(state->b_from_domain[strlen(state->b_from_domain)]), q+1, len); + if(q && strlen(q) > 5){ + memcpy(&(state->b_from_domain), q+1, strlen(q+1)-1); if(strstr(sdata->mailfrom, "<>")){ snprintf(sdata->fromemail, SMALLBUFSIZE-1, "%s", puf); sdata->fromemail[len-1] = '\0';