From: Kevin Day Date: Mon, 28 Aug 2023 03:51:19 +0000 (-0500) Subject: Security: Invalid allocation size for fll_execute_arguments_add_parameter_set(). X-Git-Tag: 0.6.7~5 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=e9546cf625c694ef9db1213d5e759774c5c87f29;p=fll Security: Invalid allocation size for fll_execute_arguments_add_parameter_set(). The size should be size * 2 because of the parameter and value are added. --- diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index 759fb9a..5511501 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -43,14 +43,15 @@ extern "C" { if (!arguments) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - f_status_t status = f_string_dynamics_increase_by(size, arguments); + f_status_t status = f_string_dynamics_increase_by(size * 2, arguments); - for (f_array_length_t i = 0; F_status_is_error_not(status) && i < size; ++i) { + for (f_array_length_t i = 0; i < size; ++i) { status = private_fll_execute_arguments_add_parameter(prefix[i], name[i], value[i], arguments); + if (F_status_is_error(status)) return status; } // for - return status; + return F_none; } #endif // _di_fll_execute_arguments_add_parameter_set_ @@ -62,12 +63,13 @@ extern "C" { f_status_t status = f_string_dynamics_increase_by(size, arguments); - for (f_array_length_t i = 0; F_status_is_error_not(status) && i < size; ++i) { + for (f_array_length_t i = 0; i < size; ++i) { status = private_fll_execute_arguments_add(source[i], arguments); + if (F_status_is_error(status)) return status; } // for - return status; + return F_none; } #endif // _di_fll_execute_arguments_add_set_