From c96f2e4e3a36629ef78187f00fae10c46a7a849f Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Mon, 18 Nov 2019 03:28:24 +0300 Subject: [PATCH] Fix strtoul error condition (#1995) endptr is set to '\0' when successful --- code/espurna/utils.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/espurna/utils.ino b/code/espurna/utils.ino index d710f42b..a0c35b9c 100644 --- a/code/espurna/utils.ino +++ b/code/espurna/utils.ino @@ -195,7 +195,7 @@ namespace Heartbeat { // invalidate the whole string when invalid chars are detected char *value_endptr = nullptr; const auto value = strtoul(cfg.c_str(), &value_endptr, 10); - if (value_endptr) { + if (value_endptr == cfg.c_str() || value_endptr[0] != '\0') { return defaultValue(); }