From 16c2929bb401d4665155354751ff148751f16980 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Fri, 24 May 2019 19:32:59 +0200 Subject: [PATCH] Fix parse_float accepting invalid input --- esphome/core/helpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index 769a7825da..c65ca919ba 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -257,7 +257,7 @@ std::string to_string(long double val) { optional parse_float(const std::string &str) { char *end; float value = ::strtof(str.c_str(), &end); - if (end == nullptr) + if (end == nullptr || end != str.end().base()) return {}; return value; }