From 2d38d721a3e032e85377ebff9156a68c7f44de59 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 10 Oct 2021 12:36:41 +0200 Subject: [PATCH] malloc check --- client/src/atrs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/src/atrs.c b/client/src/atrs.c index 27c04d409..7b2c6c318 100644 --- a/client/src/atrs.c +++ b/client/src/atrs.c @@ -11,6 +11,7 @@ #include #include #include "commonutil.h" // ARRAYLEN +#include "ui.h" // PrintAndLogEx // get a ATR description based on the atr bytes // returns description of the best match @@ -23,6 +24,10 @@ const char *getAtrInfo(const char *atr_str) { continue; if (strstr(AtrTable[i].bytes, "..") != NULL) { char *tmp_atr = malloc(slen); + if (!tmp_atr) { + PrintAndLogEx(ERR, "Out of memory error in getAtrInfo(). Aborting..."); + return NULL; + } for (int j = 0; j < slen; j++) { tmp_atr[j] = AtrTable[i].bytes[j]=='.' ? '.' : atr_str[j]; }