diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2018-12-14 14:03:18 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2018-12-14 14:07:29 +0000 |
commit | fa792e2ce96b4d6f9e39e350ec967ccb833277a7 (patch) | |
tree | f8b890e87dd578422a7034e0400175dc41c4b430 /src | |
parent | b2758501d772f37e5baa22ed2c379f0a473cffc2 (diff) |
Fix parsing of option type Kint (integer, stored in K). Bug 2348
Broken-by: a45431fa71
Diffstat (limited to 'src')
-rw-r--r-- | src/src/readconf.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/src/readconf.c b/src/src/readconf.c index f21ce4d04..44452baa6 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -2130,7 +2130,7 @@ switch (type) inttype = US"octal "; /* Integer: a simple(ish) case; allow octal and hex formats, and - suffixes K, M and G. The different types affect output, not input. */ + suffixes K, M, G, and T. The different types affect output, not input. */ case opt_mkint: case opt_int: @@ -2147,7 +2147,7 @@ switch (type) if (errno != ERANGE && *endptr) { - uschar * mp = US"GgMmKk\0"; /* YyZzEePpTtGgMmKk */ + uschar * mp = US"TtGgMmKk\0"; /* YyZzEePpTtGgMmKk */ if ((mp = Ustrchr(mp, *endptr))) { @@ -2182,8 +2182,7 @@ switch (type) *(int *)ol->value = value; break; - /* Integer held in K: again, allow octal and hex formats, and suffixes K, M, - G and T. */ + /* Integer held in K: again, allow formats and suffixes as above. */ case opt_Kint: { @@ -2197,12 +2196,12 @@ switch (type) if (errno != ERANGE && *endptr) { - uschar * mp = US"EePpTtGgMmKk\0"; /* YyZzEePpTtGgMmKk */ + uschar * mp = US"ZzEePpTtGgMmKk\0"; /* YyZzEePpTtGgMmKk */ if ((mp = Ustrchr(mp, *endptr))) { endptr++; - do + while (*(mp += 2)) { if (lvalue > EXIM_ARITH_MAX/1024 || lvalue < EXIM_ARITH_MIN/1024) { @@ -2211,7 +2210,6 @@ switch (type) } lvalue *= 1024; } - while (*(mp += 2)); } else lvalue = (lvalue + 512)/1024; @@ -2489,6 +2487,7 @@ switch(ol->type & opt_mask) int_eximarith_t x = *((int_eximarith_t *)value); if (!no_labels) printf("%s = ", name); if (x == 0) printf("0\n"); + else if ((x & ((1<<30)-1)) == 0) printf(PR_EXIM_ARITH "T\n", x >> 30); else if ((x & ((1<<20)-1)) == 0) printf(PR_EXIM_ARITH "G\n", x >> 20); else if ((x & ((1<<10)-1)) == 0) printf(PR_EXIM_ARITH "M\n", x >> 10); else printf(PR_EXIM_ARITH "K\n", x); |