aboutsummaryrefslogtreecommitdiffstats
path: root/rfc822.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-01-13 21:44:38 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-01-13 21:44:38 +0000
commit7d64feadc43b9051bc7d5f8c638d52539f91c7f6 (patch)
treefa569de056a35ebad16868bc5aa03f2062acb6cc /rfc822.c
parente644052b38ac03a5683f6ba48554dfb4cfe78c9c (diff)
downloadfetchmail-7d64feadc43b9051bc7d5f8c638d52539f91c7f6.tar.gz
fetchmail-7d64feadc43b9051bc7d5f8c638d52539f91c7f6.tar.bz2
fetchmail-7d64feadc43b9051bc7d5f8c638d52539f91c7f6.zip
Fix Steven Trainoff's bug.
svn path=/trunk/; revision=755
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 */