aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-10-08 17:27:38 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-10-08 17:28:16 +0200
commit8cbdd218673403f39061612aa7bb99a964ce0b2d (patch)
tree5d6761c13db97a327fae028c1e2452c2fd9de90e
parentae81195418ebed5280d0753d037df483bb914a0b (diff)
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: ae81195418ebed5280d0753d037df483bb914a0b Change-Id: I89d26a575ef81ee17483db035924354588d9d094
-rw-r--r--utils/gtp_echo_responder.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils/gtp_echo_responder.c b/utils/gtp_echo_responder.c
index e077c81..390fa25 100644
--- a/utils/gtp_echo_responder.c
+++ b/utils/gtp_echo_responder.c
@@ -125,7 +125,7 @@ static uint8_t parse_node_features_mask(const char *arg)
res = strtoul(arg, &end, 0);
if ((errno == ERANGE && res == ULONG_MAX) || (errno && !res) ||
- arg == end) {
+ arg == end || *end != '\0') {
fprintf(stderr, "Failed parsing Node Features bitmask: '%s'\n", arg);
exit(1);
}