mblaze

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

commit c15ed7a16861aaee70f8772c93952e978d20974f
parent 98a40b5dd31241d870b3f2ed77f10569ec834426
Author: Leah Neukirchen <leah@vuxu.org>
Date:   Sat, 24 Jun 2017 15:46:00 +0200

mexport: handle return-path without <>

Diffstat:
mexport.c | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/mexport.c b/mexport.c @@ -46,11 +46,15 @@ export(char *file) if ((v = blaze822_hdr(msg, "return-path")) || (v = blaze822_hdr(msg, "x-envelope-from"))) { char *s = strchr(v, '<'); - char *e = strchr(s, '>'); - if (s && e) { - s++; - memcpy(from, s, e-s); - from[e-s] = 0; + if (s) { + char *e = strchr(s, '>'); + if (e) { + s++; + snprintf(from, sizeof from, "%.*s", + (int)(e-s), s); + } + } else { // return-path without <> + snprintf(from, sizeof from, "%s", v); } }