add guard for size_t underflow
This commit is contained in:
1 parent
0d63e53a77
commit
c62b9e0480
1 file changed
+9
@@ -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