Permit trailing whitespace in getenv_int

This commit is contained in:
Jeff Epler 2022-12-28 12:37:27 -06:00
parent 83bbfd1815
commit 15a24b400d
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE

View File

@ -413,6 +413,9 @@ STATIC os_getenv_err_t common_hal_os_getenv_int_inner(const char *key, mp_int_t
} }
char *end; char *end;
long num = strtol(buf, &end, 0); long num = strtol(buf, &end, 0);
while (unichar_isspace(*end)) {
end++;
}
if (end == buf || *end) { // If the whole buffer was not consumed it's an error if (end == buf || *end) { // If the whole buffer was not consumed it's an error
return GETENV_ERR_UNEXPECTED | *end; return GETENV_ERR_UNEXPECTED | *end;
} }