From c96cdc19b3791eaa0a8038b0ed2f03c6d93c747e Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 4 Dec 2023 04:35:00 -0600 Subject: [PATCH] Fix 32 bit lib/args.c to report out of range numeric values. Test with "skeleton -c 8g" for example. --- lib/args.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/args.c b/lib/args.c index edf06e99..c5ba4505 100644 --- a/lib/args.c +++ b/lib/args.c @@ -207,7 +207,8 @@ static void gotflag(struct getoptflagstate *gof, struct opts *opt, int longopt) *list = xzalloc(sizeof(struct arg_list)); (*list)->arg = arg; } else if (type == '#' || type == '-') { - long l = atolx(arg); + long long l = atolx(arg); + if (type == '-' && !ispunct(*arg)) l*=-1; if (l < opt->val[0].l) help_exit("-%c < %ld", opt->c, opt->val[0].l); if (l > opt->val[1].l) help_exit("-%c > %ld", opt->c, opt->val[1].l); -- 2.39.2