From: Kevin Day Date: Sun, 5 Mar 2023 17:59:23 +0000 (-0600) Subject: Cleanup: Add explicit buffer empty checks in owner and group funcctions. X-Git-Tag: 0.6.4~23 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=1f909cf5a5826d196b87d6a8c67973c672056eff;p=fll Cleanup: Add explicit buffer empty checks in owner and group funcctions. --- diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index 642e986..97740cc 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -42,6 +42,12 @@ extern "C" { #ifndef _di_fake_make_get_id_group_ f_status_t fake_make_get_id_group(fake_data_t * const data, const fl_print_t print, const f_string_static_t buffer, gid_t *id) { + if (!buffer.used) { + fll_error_print(print, F_parameter, "fake_make_get_id_group", F_true); + + return F_status_set_error(F_parameter); + } + f_number_unsigned_t number = 0; f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, buffer, &number); @@ -137,6 +143,12 @@ extern "C" { #ifndef _di_fake_make_get_id_owner_ f_status_t fake_make_get_id_owner(fake_data_t * const data, const fl_print_t print, const f_string_static_t buffer, uid_t *id) { + if (!buffer.used) { + fll_error_print(print, F_parameter, "fake_make_get_id_owner", F_true); + + return F_status_set_error(F_parameter); + } + f_number_unsigned_t number = 0; f_status_t status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, buffer, &number); diff --git a/level_3/fake/c/private-make.h b/level_3/fake/c/private-make.h index 365aae7..e7b2272 100644 --- a/level_3/fake/c/private-make.h +++ b/level_3/fake/c/private-make.h @@ -110,6 +110,8 @@ extern "C" { * The NULL terminated path to get the relative path of. * * @return + * F_none on success. + * * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_path_relative_