From 75d4acfe94d012a3ddab6bfc4a4cb9cb5fee7f2d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 21 Apr 2026 11:58:53 +1000 Subject: [PATCH] util: allow for 'e' in safe_atod strings 1.5e2 is a valid string, so let's parse those. Part-of: --- src/util-strings.h | 1 + test/test-utils.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/util-strings.h b/src/util-strings.h index 94236c48..063ebaf3 100644 --- a/src/util-strings.h +++ b/src/util-strings.h @@ -282,6 +282,7 @@ safe_atod(const char *str, double *val) case '+': case '-': case '.': + case 'e': break; default: return false; diff --git a/test/test-utils.c b/test/test-utils.c index 9032b377..c9b0e9ef 100644 --- a/test/test-utils.c +++ b/test/test-utils.c @@ -1612,6 +1612,7 @@ START_TEST(safe_atod_test) { "2147483647", true, 2147483647 }, { "-2147483648", true, -2147483648 }, { "4294967295", true, 4294967295 }, + { "-1.3e-1", true, -0.130}, { "0x0", false, 0 }, { "0x10", false, 0 }, { "0xaf", false, 0 },