From c15ed7a16861aaee70f8772c93952e978d20974f Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Sat, 24 Jun 2017 15:46:00 +0200 Subject: mexport: handle return-path without <> --- mexport.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'mexport.c') diff --git a/mexport.c b/mexport.c index 1a7d599..ef31618 100644 --- 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); } } -- cgit 1.4.1