Przeglądaj źródła

fix buffer overflow in mifar ul load (#1697)

Co-authored-by: gornekich <n.gorbadey@gmail.com>
VVX7 3 lat temu
rodzic
commit
8d8481b17f
1 zmienionych plików z 1 dodań i 0 usunięć
  1. 1 0
      lib/nfc/nfc_device.c

+ 1 - 0
lib/nfc/nfc_device.c

@@ -195,6 +195,7 @@ bool nfc_device_load_mifare_ul_data(FlipperFormat* file, NfcDevice* dev) {
         }
         }
         data->data_size = pages_total * 4;
         data->data_size = pages_total * 4;
         data->data_read = pages_read * 4;
         data->data_read = pages_read * 4;
+        if(data->data_size > MF_UL_MAX_DUMP_SIZE || data->data_read > MF_UL_MAX_DUMP_SIZE) break;
         bool pages_parsed = true;
         bool pages_parsed = true;
         for(uint16_t i = 0; i < pages_total; i++) {
         for(uint16_t i = 0; i < pages_total; i++) {
             string_printf(temp_str, "Page %d", i);
             string_printf(temp_str, "Page %d", i);