From 02316e5fc36c619bbc70c82f78d39e043faea06e Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Fri, 24 Dec 2021 11:51:23 +0200 Subject: [PATCH] DesfireExchangeEx dyn memory --- client/src/mifare/desfirecore.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/mifare/desfirecore.c b/client/src/mifare/desfirecore.c index fa50753b5..844b92223 100644 --- a/client/src/mifare/desfirecore.c +++ b/client/src/mifare/desfirecore.c @@ -799,7 +799,9 @@ int DesfireExchangeEx(bool activate_field, DesfireContext_t *ctx, uint8_t cmd, u if (!PrintChannelModeWarning(cmd, ctx->secureChannel, ctx->cmdSet, ctx->commMode)) DesfirePrintContext(ctx); - uint8_t databuf[250 * 5] = {0}; + uint8_t *databuf = calloc(DESFIRE_BUFFER_SIZE, 1); + if (databuf == NULL) + return PM3_EMALLOC; size_t databuflen = 0; switch (ctx->cmdSet) { @@ -828,10 +830,12 @@ int DesfireExchangeEx(bool activate_field, DesfireContext_t *ctx, uint8_t cmd, u } break; case DCCISO: + free(databuf); return PM3_EAPDU_FAIL; break; } + free(databuf); return res; }