RFID: Fix integer overflow, fix printf usage (#742)

* Fix comparison of constant 300 with expression of type 'uint8_t' is always false

rfid-worker.cpp:111 if(validate_counts > (5 * 60))

* Fix format string is not a string literal (potentially insecure)

Co-authored-by: Tony Freeman <tonyfreeman@users.noreply.github.com>
This commit is contained in:
tonyfreeman 2021-10-04 02:30:47 +03:00 committed by GitHub
parent 89a6c09a7a
commit a7edebce69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -43,6 +43,6 @@ private:
void sq_write();
void sq_write_start_validate();
void sq_write_validate();
uint8_t validate_counts;
uint16_t validate_counts;
void sq_write_stop_validate();
};

View file

@ -55,7 +55,7 @@ void lfrfid_cli_read(Cli* cli) {
printf("Reading RFID...\r\nPress Ctrl+C to abort\r\n");
while(!cli_cmd_interrupt_received(cli)) {
if(reader.read(&type, data, data_size)) {
printf(lfrfid_key_get_type_string(type));
printf("%s", lfrfid_key_get_type_string(type));
printf(" ");
for(uint8_t i = 0; i < lfrfid_key_get_type_data_count(type); i++) {