From: Kevin Day Date: Wed, 23 Nov 2022 01:43:16 +0000 (-0600) Subject: Security: Invalid access when calling fake without 'make' or 'build'. X-Git-Tag: 0.6.2~67 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=4ef64c0af214ba8dab31e35a8d5434d782eb9fb8;p=fll Security: Invalid access when calling fake without 'make' or 'build'. This is caused by the F_data_not return result not being processed in some of the fl_fss functions. Additional changes: - Make the return status constant. - The status is being returned regardless in some cases so remove the effectively redundant lines of code. - Combined the additional if condition blocks together. --- diff --git a/level_1/fl_fss/c/fss/basic.c b/level_1/fl_fss/c/fss/basic.c index d081b3d..610848e 100644 --- a/level_1/fl_fss/c/fss/basic.c +++ b/level_1/fl_fss/c/fss/basic.c @@ -133,9 +133,9 @@ extern "C" { const f_array_length_t delimits_used = delimits->used; - f_status_t status = private_fl_fss_basic_read(buffer, F_true, state, range, found, quote, delimits); + const f_status_t status = private_fl_fss_basic_read(buffer, F_true, state, range, found, quote, delimits); - if (F_status_is_error(status)) { + if (F_status_is_error(status) || status == F_fss_found_object_not || status == F_data_not || status == F_data_not_eos || status == F_data_not_stop) { delimits->used = delimits_used; } diff --git a/level_1/fl_fss/c/fss/extended.c b/level_1/fl_fss/c/fss/extended.c index 48be121..d762420 100644 --- a/level_1/fl_fss/c/fss/extended.c +++ b/level_1/fl_fss/c/fss/extended.c @@ -185,18 +185,10 @@ extern "C" { const f_array_length_t delimits_used = delimits->used; - f_status_t status = private_fl_fss_basic_read(buffer, F_true, state, range, found, quoted, delimits); + const f_status_t status = private_fl_fss_basic_read(buffer, F_true, state, range, found, quoted, delimits); - if (F_status_is_error(status)) { + if (F_status_is_error(status) || status == F_fss_found_object_not || status == F_data_not || status == F_data_not_eos || status == F_data_not_stop) { delimits->used = delimits_used; - - return status; - } - - if (status == F_fss_found_object_not || status == F_data_not || status == F_data_not_eos || status == F_data_not_stop) { - delimits->used = delimits_used; - - return status; } return status; diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index fb138b9..f027405 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -136,13 +136,9 @@ extern "C" { return F_fss_found_object_not; } - if (status == F_none_eos) { - return F_data_not_eos; - } - - if (status == F_none_stop) { - return F_data_not_stop; - } + if (status == F_none_eos) return F_data_not_eos; + if (status == F_none_stop) return F_data_not_stop; + if (status == F_data_not) return status; // Begin the search. found->start = range->start; @@ -704,17 +700,10 @@ extern "C" { f_status_t status = f_fss_skip_past_space(state, object, range); if (F_status_is_error(status)) return status; - if (status == F_none_eos) { - return F_data_not_eos; - } - - if (status == F_none_stop) { - return F_data_not_stop; - } - - if (status == F_none_eol) { - return F_status_set_error(F_none_eol); - } + if (status == F_none_eos) return F_data_not_eos; + if (status == F_none_stop) return F_data_not_stop; + if (status == F_none_eol) return F_status_set_error(F_none_eol); + if (status == F_data_not) return status; // Ensure that there is room for the potential start and stop quotes, a potential delimit at start, and the potential object open character. status = f_string_dynamic_increase_by(5, destination);