From a0976f87118cc8d9ccc7a79f2ef29935798284e1 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Fri, 16 Jun 2023 00:34:41 -0400 Subject: [PATCH] cdecl99: Avoid passing uninitialized value to help_print_option. For options that do not take arguments, the "arg" member of the help structure is not assigned by lopt_get_help. Since the structure is not otherwise initialized, it is technically undefined to even evaluate this member in order to pass it to the help_print_option function. In this case, the argument is not actually used, and I'm not aware of any actual failures as a result, but it easy enough to avoid. --- src/cdecl99.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cdecl99.c b/src/cdecl99.c index eac0023..5ddc889 100644 --- a/src/cdecl99.c +++ b/src/cdecl99.c @@ -79,6 +79,7 @@ static void print_usage(FILE *f) static void print_help(const struct option *lopts) { + struct lopt_help help = {0}; const struct option *opt; print_usage(stdout); @@ -89,8 +90,6 @@ static void print_help(const struct option *lopts) puts(_("Options:")); for (opt = lopts; opt->name; opt++) { - struct lopt_help help; - if (!lopt_get_help(opt, &help)) continue; -- 2.43.2