mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-29 22:24:26 +00:00 
			
		
		
		
	Fix parse_float accepting invalid input
This commit is contained in:
		| @@ -257,7 +257,7 @@ std::string to_string(long double val) { | ||||
| optional<float> 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; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user