mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-ggsn.git
synced 2025-10-23 00:12:08 +00:00
gtp_echo_responder: report invalid chars present in node-feautres cmdline arg as error
from "man strtoul":
"""
If endptr is not NULL, strtoul() stores the address of the first invalid character in *endptr.
In particular, if *nptr is not '\0' but **endptr is '\0' on return, the entire string is valid.
"""
Fixes: ae81195418
Change-Id: I89d26a575ef81ee17483db035924354588d9d094
This commit is contained in:
@@ -125,7 +125,7 @@ static uint8_t parse_node_features_mask(const char *arg)
|
|||||||
|
|
||||||
res = strtoul(arg, &end, 0);
|
res = strtoul(arg, &end, 0);
|
||||||
if ((errno == ERANGE && res == ULONG_MAX) || (errno && !res) ||
|
if ((errno == ERANGE && res == ULONG_MAX) || (errno && !res) ||
|
||||||
arg == end) {
|
arg == end || *end != '\0') {
|
||||||
fprintf(stderr, "Failed parsing Node Features bitmask: '%s'\n", arg);
|
fprintf(stderr, "Failed parsing Node Features bitmask: '%s'\n", arg);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user