mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
add guard for size_t underflow
This commit is contained in:
@@ -600,6 +600,15 @@ void *mifare_cryto_postprocess_data(desfiretag_t tag, void *data, size_t *nbytes
|
||||
|
||||
if ((communication_settings & MAC_VERIFY) == MAC_VERIFY) {
|
||||
|
||||
if (*nbytes < key_macing_length(key)) {
|
||||
*nbytes = -1;
|
||||
res = NULL;
|
||||
#ifdef WITH_DEBUG
|
||||
Dbprintf("No room for MAC!");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
*nbytes -= key_macing_length(key);
|
||||
|
||||
if (*nbytes == 0) {
|
||||
|
||||
Reference in New Issue
Block a user