From 8cbdd218673403f39061612aa7bb99a964ce0b2d Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 8 Oct 2021 17:27:38 +0200 Subject: [PATCH] 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 --- utils/gtp_echo_responder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); }