From e6a2ce56b18b17f4fc8de08e81704c215643807d Mon Sep 17 00:00:00 2001 From: Feideus Date: Sun, 24 Jun 2018 11:35:21 +0200 Subject: [PATCH] getopt blindly accepting negative input fix --- src/util/getopt_helpers.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c index c55b22fb6..32cce65dd 100644 --- a/src/util/getopt_helpers.c +++ b/src/util/getopt_helpers.c @@ -748,6 +748,13 @@ set_uint (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, unsigned int *val = scls; (void) ctx; + if('-' == *value) + { + FPRINTF (stderr, + _("Your input for the '%s' option has to be a non negative number \n"), + option); + return GNUNET_SYSERR; + } if (1 != SSCANF (value, "%u", val)) -- 2.25.1