mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 21:18:35 -07:00
Desktop: Sanity check PIN length for good measure (#3879)
* Desktop: Sanity check PIN length for good measure * Desktop: replace hardcoded values with macros in desktop_view_pin_input.c Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -58,7 +58,8 @@ static uint32_t desktop_pin_code_pack(const DesktopPinCode* pin_code) {
|
||||
}
|
||||
|
||||
bool desktop_pin_code_is_set(void) {
|
||||
return furi_hal_rtc_get_pin_value() >> DESKTOP_PIN_CODE_LENGTH_OFFSET;
|
||||
uint8_t length = furi_hal_rtc_get_pin_value() >> DESKTOP_PIN_CODE_LENGTH_OFFSET;
|
||||
return length >= DESKTOP_PIN_CODE_MIN_LEN && length <= DESKTOP_PIN_CODE_MAX_LEN;
|
||||
}
|
||||
|
||||
void desktop_pin_code_set(const DesktopPinCode* pin_code) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define DESKTOP_PIN_CODE_MIN_LEN (4)
|
||||
#define DESKTOP_PIN_CODE_MAX_LEN (10)
|
||||
|
||||
typedef struct {
|
||||
|
||||
Reference in New Issue
Block a user