From d4e3f934e2522d7e360e74d6a9414e4db35b9ed6 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 17 Nov 2019 00:58:40 -0600 Subject: [PATCH] Bugfix: When --last is set to 0, entire file is dumped The --last value being set to 0 is internally used to represent entire file. Explicitly setting --last to 0 makes no sense, so set the minimum allowed size for --last to 1. --- level_3/byte_dump/c/byte_dump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index cda6533..5bdc724 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -219,11 +219,11 @@ extern "C" { f_number_unsigned number = 0; status = fl_console_parameter_to_number_unsigned(arguments.argv[data->parameters[byte_dump_parameter_last].additional.array[data->parameters[byte_dump_parameter_last].additional.used - 1]], &number); - if (f_status_is_error(status) || number > f_type_number_size_unsigned) { + if (f_status_is_error(status) || number < 1 || number > f_type_number_size_unsigned) { fl_color_print(f_standard_error, data->context.error, data->context.reset, "ERROR: The parameter '"); fl_color_print(f_standard_error, data->context.notable, data->context.reset, "--%s", byte_dump_long_last); fl_color_print(f_standard_error, data->context.error, data->context.reset, "' value can only be a number (inclusively) between "); - fl_color_print(f_standard_error, data->context.notable, data->context.reset, "0"); + fl_color_print(f_standard_error, data->context.notable, data->context.reset, "1"); fl_color_print(f_standard_error, data->context.error, data->context.reset, " and "); fl_color_print(f_standard_error, data->context.notable, data->context.reset, "%llu", f_type_number_size_unsigned); fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "."); -- 1.8.3.1