diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-05-06 06:35:11 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-05-06 06:35:11 +0000 |
commit | 8f46eccd144567b9450c2dbe7586fb70b2d05154 (patch) | |
tree | c7bf58c52ccd212bc91f40b6810627b4ec03ba67 /rfc822.c | |
parent | 97adb78e495ec70eb5926bb778ba01d77843aa45 (diff) | |
download | fetchmail-8f46eccd144567b9450c2dbe7586fb70b2d05154.tar.gz fetchmail-8f46eccd144567b9450c2dbe7586fb70b2d05154.tar.bz2 fetchmail-8f46eccd144567b9450c2dbe7586fb70b2d05154.zip |
Prevent rewrite from fooing up on a blank To: header.
svn path=/trunk/; revision=981
Diffstat (limited to 'rfc822.c')
-rw-r--r-- | rfc822.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -27,7 +27,7 @@ char *buf; /* header to be hacked */ const char *host; /* server hostname */ { char *from, *cp; - int parendepth, state, has_host_part; + int parendepth, state, has_bare_name_part, has_host_part; if (strncmp("From: ", buf, 6) && strncmp("To: ", buf, 4) @@ -38,7 +38,7 @@ const char *host; /* server hostname */ } parendepth = state = 0; - has_host_part = FALSE; + has_host_part = has_bare_name_part = FALSE; for (from = buf; *from; from++) { #ifdef TESTMAIN @@ -69,7 +69,7 @@ const char *host; /* server hostname */ has_host_part = TRUE; else if (*from == '"') state = 2; - else if ((*from == ',' || HEADER_END(from)) && !has_host_part) + else if ((*from == ',' || HEADER_END(from)) && has_bare_name_part && !has_host_part) { int hostlen; @@ -83,7 +83,9 @@ const char *host; /* server hostname */ memcpy(from, host, hostlen); from += strlen(from); has_host_part = TRUE; - } + } + else if (!isspace(*from)) + has_bare_name_part = TRUE; break; case 2: /* we're in a string */ |