aboutsummaryrefslogtreecommitdiffstats
path: root/rfc822.c
diff options
context:
space:
mode:
Diffstat (limited to 'rfc822.c')
-rw-r--r--rfc822.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/rfc822.c b/rfc822.c
index 31bf0c67..8820b1b5 100644
--- a/rfc822.c
+++ b/rfc822.c
@@ -233,29 +233,34 @@ const char *hdr; /* header to be parsed, NUL to continue previous hdr */
case BARE_ADDRESS: /* collecting address without delimiters */
if (*hp == '\n') /* end of bare address */
{
- *tp++ = '\0';
- state = ENDIT_ALL;
- return(tp = address);
+ if (tp > address)
+ {
+ *tp++ = '\0';
+ state = ENDIT_ALL;
+ return(tp = address);
+ }
}
else if (*hp == '\\') /* handle RFC822 escaping */
{
*tp++ = *hp++; /* take the escape */
*tp++ = *hp; /* take following char */
}
- else if (*hp == ',' || isspace(*hp)) /* end of address */
+ else if (*hp == ',') /* end of address */
{
if (tp > address)
{
*tp++ = '\0';
- ++hp;
state = SKIP_JUNK;
return(tp = address);
}
}
- else /* just take it */
+ else if (*hp == '<') /* beginning of real address */
{
- *tp++ = *hp;
+ state = INSIDE_BRACKETS;
+ tp = address;
}
+ else /* just take it */
+ *tp++ = *hp;
break;
case INSIDE_DQUOTE: /* we're in a quoted string, copy verbatim */