Skip to content

Commit

Permalink
Check for rogue minus sign when parsing unsigned numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
gsurkov committed Jul 15, 2024
1 parent ffa3996 commit b7f1995
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/flipper_format/flipper_format_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b7f1995

Please sign in to comment.