mirror of
https://github.com/curl/curl.git
synced 2025-01-18 14:04:30 +08:00
tool_paramhlp: improve str2num(): avoid unnecessary call to strlen()
Closes #11742
This commit is contained in:
parent
864090ca39
commit
458c70db6a
@ -138,7 +138,7 @@ static ParameterError getnum(long *val, const char *str, int base)
|
||||
num = strtol(str, &endptr, base);
|
||||
if(errno == ERANGE)
|
||||
return PARAM_NUMBER_TOO_LARGE;
|
||||
if((endptr != str) && (endptr == str + strlen(str))) {
|
||||
if((endptr != str) && (*endptr == '\0')) {
|
||||
*val = num;
|
||||
return PARAM_OK; /* Ok */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user