aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-06-24 15:46:00 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-06-24 15:46:00 +0200
commitc15ed7a16861aaee70f8772c93952e978d20974f (patch)
tree3ba788bc6cd317beb2697cf17176092934dfb79c
parent98a40b5dd31241d870b3f2ed77f10569ec834426 (diff)
downloadmblaze-c15ed7a16861aaee70f8772c93952e978d20974f.tar.gz
mexport: handle return-path without <>
-rw-r--r--mexport.c14
1 files changed, 9 insertions, 5 deletions
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);
}
}