aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-08-09 15:49:59 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-08-09 15:49:59 +0200
commit4bb35cbead555a4e9080c58a8de71ed0887e8db5 (patch)
tree5aed4164c36fe02ef70876feaf22e2c6d5411566
parentedf4458016077547b7e76b79971f86f19fbd1819 (diff)
downloadmblaze-4bb35cbead555a4e9080c58a8de71ed0887e8db5.tar.gz
blaze822: blaze822_addr: make a bit more robust
Start over when seeing another < in the address part. Support "..." in the address part.
-rw-r--r--blaze822.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/blaze822.c b/blaze822.c
index 9a596b6..a96cd11 100644
--- 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;