diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-01-13 21:44:38 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-01-13 21:44:38 +0000 |
commit | 7d64feadc43b9051bc7d5f8c638d52539f91c7f6 (patch) | |
tree | fa569de056a35ebad16868bc5aa03f2062acb6cc /rfc822.c | |
parent | e644052b38ac03a5683f6ba48554dfb4cfe78c9c (diff) | |
download | fetchmail-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.c | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -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 */ |