git://git.exim.org
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
04a3b93
)
Fix bogus error message copy. Bug 2857
author
Jeremy Harris
<jgh146exb@wizmail.org>
Sun, 6 Feb 2022 19:00:26 +0000
(19:00 +0000)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Sun, 6 Feb 2022 20:03:08 +0000
(20:03 +0000)
Broken-by: bb43acbd98
src/src/parse.c
patch
|
blob
|
history
diff --git
a/src/src/parse.c
b/src/src/parse.c
index 5bf97eab9e328f8d990b903b1ada450f679f0953..edbee2646d021769b00315666140211e02666563 100644
(file)
--- a/
src/src/parse.c
+++ b/
src/src/parse.c
@@
-1354,15
+1354,16
@@
for (;;)
if (special)
{
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;
}
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;
}
return special;
}