mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-03 17:59:16 +00:00
Check for rogue minus sign when parsing unsigned numbers
This commit is contained in:
parent
ffa3996a5e
commit
b7f1995948
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue