From 6830ddad67e245b7aed7ef0c3dfcf775d68a4841 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Thu, 19 Dec 2024 08:44:00 +0200 Subject: [PATCH] tncattach - WHen parsing the `prefixPart_s` (the prefix length), only continue if the text is a number, if not then bail out with an error --- tncattach.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tncattach.c b/tncattach.c index ab5772c..04041eb 100644 --- a/tncattach.c +++ b/tncattach.c @@ -504,6 +504,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { long prefixLen_l = strtol(prefixPart_s, NULL, 10); // TODO: Add handling here for errors (using errno) + if(prefixLen_l == 0) { + printf("Prefix length '%s' is not numeric\n", prefixPart_s); + exit(EXIT_FAILURE); + } arguments->ipv6 = ipPart_s;