From fdfef157675f3a1c634014da22d0862d53e986f8 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 18 Jun 2022 19:22:56 -0500 Subject: [PATCH] Security: Floating point exception due to incorrect number type used in conversion function. The power is being used as the entire value. To do this it must be capable of holding the entire supported digits of f_number_unsigned_t. Using int results in a floating point exception. --- level_0/f_conversion/c/private-conversion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/level_0/f_conversion/c/private-conversion.c b/level_0/f_conversion/c/private-conversion.c index 72d0e67..248071a 100644 --- a/level_0/f_conversion/c/private-conversion.c +++ b/level_0/f_conversion/c/private-conversion.c @@ -88,7 +88,7 @@ extern "C" { f_status_t private_f_conversion_digit_to_file_number(const f_conversion_data_t data, f_number_unsigned_t number, int digits, FILE * const stream) { f_number_unsigned_t current = 0; - int power = 1; + f_number_unsigned_t power = 1; f_number_unsigned_t work = 0; for (register uint8_t i = 1; i < digits; ++i) { -- 1.8.3.1