mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit 4bb35cbead555a4e9080c58a8de71ed0887e8db5
parent edf4458016077547b7e76b79971f86f19fbd1819
Author: Christian Neukirchen <chneukirchen@gmail.com>
Date:   Tue,  9 Aug 2016 15:49:59 +0200

blaze822: blaze822_addr: make a bit more robust

Start over when seeing another < in the address part.

Support "..." in the address part.

Diffstat:
blaze822.c | 17+++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/blaze822.c b/blaze822.c @@ -151,13 +151,26 @@ blaze822_addr(char *s, char **dispo, char **addro) *addr = 0; while (*s) { + startover: if (*s == '<') { char *c = addr; char *e = addr + sizeof addr; s++; - while (*s && c < e && *s != '>') - *c++ = *s++; + while (*s && c < e && *s != '>') { + if (*s == '<') { + goto startover; + } else if (*s == '"') { + // local part may be quoted, allow all + s++; + while (*s && c < e && *s != '"') + *c++ = *s++; + if (*s == '"') + s++; + } else { + *c++ = *s++; + } + } if (*s == '>') s++; *c = 0;