summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNigel Metheringham <nigel@exim.org>2008-12-12 14:51:47 +0000
committerNigel Metheringham <nigel@exim.org>2008-12-12 14:51:47 +0000
commitb52bc06efc7a59bd262994eda285d2b125b767d7 (patch)
treee19b9d68630eed33d6fca2c1487e0b26cf3eceac /src
parentcf73943b330a44b8716aa1fcbf649ee1f0fbc67b (diff)
Make whitespace strings compare euqal to zero. fixes: bug #749
Diffstat (limited to 'src')
-rw-r--r--src/src/expand.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/src/expand.c b/src/src/expand.c
index cd84294ae..599dd9c0d 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/expand.c,v 1.96 2008/08/07 11:05:03 fanf2 Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.97 2008/12/12 14:51:47 nm4 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -5874,6 +5874,23 @@ systems, so we set it zero ourselves. */
errno = 0;
expand_string_message = NULL; /* Indicates no error */
+
+/* Before Exim 4.64, strings consisting entirely of whitespace compared
+equal to 0. Unfortunately, people actually relied upon that, so preserve
+the behaviour explicitly. Stripping leading whitespace is a harmless
+noop change since strtol skips it anyway (provided that there is a number
+to find at all). */
+if (isspace(*s))
+ {
+ while (isspace(*s)) ++s;
+ if (*s == '\0')
+ {
+ DEBUG(D_expand)
+ debug_printf("treating blank string as number 0\n");
+ return 0;
+ }
+ }
+
value = strtol(CS s, CSS &endptr, 10);
if (endptr == s)