revisit some calls of strtol(), stroul(), strtoull()
Replace some with atoi(), where the VTY has already validated correct
range of the argument.
Replace others with the new osmo_str_to_int() or osmo_str_to_int64()
functions, possibly covering more detection of invalid number strings.
Leave those strtol() callers that depend on endptr to provide the next
string token.
Related: SYS#5542
Change-Id: I0ebb06e751c28f7d1cdf328de29cd227a2449391
diff --git a/utils/osmo-aka-verify.c b/utils/osmo-aka-verify.c
index 086add5..bbc65ef 100644
--- a/utils/osmo-aka-verify.c
+++ b/utils/osmo-aka-verify.c
@@ -123,6 +123,7 @@
bool opc_is_set = false;
bool amf_is_set = false;
bool opc_is_op = false;
+ int64_t val64;
while (1) {
int c;
@@ -169,7 +170,8 @@
amf_is_set = true;
break;
case 's':
- g_sqn = strtoull(optarg, 0, 10);
+ rc = osmo_str_to_int64(&val64, optarg, 10, 0, INT64_MAX);
+ g_sqn = (unsigned long long)val64;
sqn_is_set = true;
break;
case 'r':