diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2021-09-05 19:50:34 +0200 |
---|---|---|
committer | neels <nhofmeyr@sysmocom.de> | 2021-10-04 11:24:59 +0000 |
commit | 34907fe6e14965fccd9f2eec3e857eac78e2bb17 (patch) | |
tree | 8a7ce6ebd60f50562ba977c216aa96ebfab2f7d3 /utils | |
parent | 6b60d52abf0a12a21f6f11150a5e3a0dd3eceda6 (diff) |
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
Diffstat (limited to 'utils')
-rw-r--r-- | utils/osmo-aka-verify.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/osmo-aka-verify.c b/utils/osmo-aka-verify.c index 086add55..bbc65ef7 100644 --- a/utils/osmo-aka-verify.c +++ b/utils/osmo-aka-verify.c @@ -123,6 +123,7 @@ static int handle_options(int argc, char **argv) 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 @@ static int handle_options(int argc, char **argv) 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': |