Browse Source

Fix strtoul error condition (#1995)

endptr is set to '\0' when successful
master
Max Prokhorov 5 years ago
committed by GitHub
parent
commit
c96f2e4e3a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      code/espurna/utils.ino

+ 1
- 1
code/espurna/utils.ino View File

@ -195,7 +195,7 @@ namespace Heartbeat {
// invalidate the whole string when invalid chars are detected // invalidate the whole string when invalid chars are detected
char *value_endptr = nullptr; char *value_endptr = nullptr;
const auto value = strtoul(cfg.c_str(), &value_endptr, 10); 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(); return defaultValue();
} }


Loading…
Cancel
Save