From 8aa129395f93367b9f967d4e0c4bf7dc680f23ca Mon Sep 17 00:00:00 2001 From: Georgii Surkov <37121527+gsurkov@users.noreply.github.com> Date: Tue, 16 Jul 2024 12:54:09 +0100 Subject: [PATCH] [FL-3871] Infrared: check for negative timings (#3788) --- lib/flipper_format/flipper_format_stream.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/flipper_format/flipper_format_stream.c b/lib/flipper_format/flipper_format_stream.c index 83e77a4e2..b9d33169c 100644 --- a/lib/flipper_format/flipper_format_stream.c +++ b/lib/flipper_format/flipper_format_stream.c @@ -400,7 +400,11 @@ bool flipper_format_stream_read_value_line( }; break; case FlipperStreamValueUint32: { uint32_t* data = _data; - scan_values = sscanf(furi_string_get_cstr(value), "%" PRIu32, &data[i]); + // Minus sign is allowed in scanf() for unsigned numbers, resulting in unintentionally huge values with no error reported + if(!furi_string_start_with(value, "-")) { + scan_values = + sscanf(furi_string_get_cstr(value), "%" PRIu32, &data[i]); + } }; break; case FlipperStreamValueHexUint64: { uint64_t* data = _data;