From 458c70db6a8e51e6f47313ac91da736cfe8d3fbb Mon Sep 17 00:00:00 2001 From: Gerome Fournier Date: Sun, 27 Aug 2023 13:25:47 +0200 Subject: [PATCH] tool_paramhlp: improve str2num(): avoid unnecessary call to strlen() Closes #11742 --- src/tool_paramhlp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index d2248442b1..d70e80db4b 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -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 */ }