diff options
author | TAKAHASHI Tamotsu <ttakah@lapis.plala.or.jp> | 2010-03-02 11:31:36 -0800 |
---|---|---|
committer | TAKAHASHI Tamotsu <ttakah@lapis.plala.or.jp> | 2010-03-02 11:31:36 -0800 |
commit | aa3030b146d6292044a0fd6ec1224d67b542108e (patch) | |
tree | 2a3e4e6235bfdf8330b97a494459c127f5a3b1b4 /rfc822.c | |
parent | 7f6b8c40853eaec414109a23faf3a079274a6aee (diff) |
Fix #2014.
Thanks to Vincent Lefevre for help with this one.
Diffstat (limited to 'rfc822.c')
-rw-r--r-- | rfc822.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -177,17 +177,10 @@ parse_comment (const char *s, static const char * parse_quote (const char *s, char *token, size_t *tokenlen, size_t tokenmax) { - if (*tokenlen < tokenmax) - token[(*tokenlen)++] = '"'; while (*s) { if (*tokenlen < tokenmax) token[*tokenlen] = *s; - if (*s == '"') - { - (*tokenlen)++; - return (s + 1); - } if (*s == '\\') { if (!*++s) @@ -196,6 +189,8 @@ parse_quote (const char *s, char *token, size_t *tokenlen, size_t tokenmax) if (*tokenlen < tokenmax) token[*tokenlen] = *s; } + else if (*s == '"') + return (s + 1); (*tokenlen)++; s++; } @@ -431,6 +426,17 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS *top, const char *s) } s = ps; } + else if (*s == '"') + { + if (phraselen && phraselen < sizeof (phrase) - 1) + phrase[phraselen++] = ' '; + if ((ps = parse_quote (s + 1, phrase, &phraselen, sizeof (phrase) - 1)) == NULL) + { + rfc822_free_address (&top); + return NULL; + } + s = ps; + } else if (*s == ':') { cur = rfc822_new_address (); @@ -490,11 +496,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS *top, const char *s) terminate_buffer (phrase, phraselen); cur = rfc822_new_address (); if (phraselen) - { - /* if we get something like "Michael R. Elkins" remove the quotes */ - rfc822_dequote_comment (phrase); cur->personal = safe_strdup (phrase); - } if ((ps = parse_route_addr (s + 1, comment, &commentlen, sizeof (comment) - 1, cur)) == NULL) { rfc822_free_address (&top); |