diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2022-02-06 19:00:26 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2022-02-06 20:03:08 +0000 |
commit | 7ad863f3819407559cd654639c25dcae427c190f (patch) | |
tree | 9810783398ae83ab80323e055ca9f10b4a25c43e /src | |
parent | 04a3b93f1da94cc128f2e46a22edb7f8f6a8791b (diff) |
Fix bogus error message copy. Bug 2857
Broken-by: bb43acbd98
Diffstat (limited to 'src')
-rw-r--r-- | src/src/parse.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/src/parse.c b/src/src/parse.c index 5bf97eab9..edbee2646 100644 --- a/src/src/parse.c +++ b/src/src/parse.c @@ -1354,15 +1354,16 @@ for (;;) if (special) { - uschar *ss = Ustrchr(s+1, ':') + 1; + uschar * ss = Ustrchr(s+1, ':') + 1; /* line after the special... */ if ((options & specopt) == specbit) { *error = string_sprintf("\"%.*s\" is not permitted", len, s); return FF_ERROR; } - while (*ss && isspace(*ss)) ss++; - while (s[len] && s[len] != '\n') len++; - *error = string_copyn(ss, s + len - ss); + while (*ss && isspace(*ss)) ss++; /* skip leading whitespace */ + if ((len = Ustrlen(ss)) > 0) /* ignore trailing newlines */ + for (const uschar * t = ss + len - 1; t >= ss && *t == '\n'; t--) len--; + *error = string_copyn(ss, len); /* becomes the error */ return special; } |