From: Kevin Day Date: Sun, 25 Dec 2022 01:34:40 +0000 (-0600) Subject: Security: Check if 'main' is NULL. X-Git-Tag: 0.6.3~52 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=767c244e7c023880b4eb555a07a42f5d8e4b364e;p=fll Security: Check if 'main' is NULL. --- diff --git a/level_3/control/c/control.c b/level_3/control/c/control.c index 4958d1c..5b57bcd 100644 --- a/level_3/control/c/control.c +++ b/level_3/control/c/control.c @@ -10,6 +10,8 @@ extern "C" { #ifndef _di_control_print_help_ f_status_t control_print_help(const fll_program_data_t * const main) { + if (!main) return F_output_not; + flockfile(main->output.to.stream); fll_program_print_help_header(main->output.to, main->context, control_program_name_long_s, control_program_version_s); diff --git a/level_3/control/c/control.h b/level_3/control/c/control.h index c218b00..2d4f23a 100644 --- a/level_3/control/c/control.h +++ b/level_3/control/c/control.h @@ -65,6 +65,7 @@ extern "C" { * * @return * F_none on success. + * F_output_not on success, but no printing is performed. * * @see control_main() */ diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index 500f7dd..a88cda6 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -15,6 +15,8 @@ extern "C" { #ifndef _di_controller_print_help_ f_status_t controller_print_help(controller_main_t * const main) { + if (!main) return F_output_not; + controller_lock_print(main->output.to, 0); fll_program_print_help_header(main->output.to, main->context, *main->program_name_long, controller_program_version_s); diff --git a/level_3/controller/c/controller.h b/level_3/controller/c/controller.h index e30842a..69c5971 100644 --- a/level_3/controller/c/controller.h +++ b/level_3/controller/c/controller.h @@ -91,6 +91,7 @@ extern "C" { * * @return * F_none on success. + * F_output_not on success, but no printing is performed. * * @see controller_main() */