From af6fdd09e209302f2d339c8d57e759a9a5deaf2f Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 18 Feb 2025 18:43:10 +0100 Subject: [PATCH] make sure variable are set before being used --- client/src/cmdlfem410x.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/src/cmdlfem410x.c b/client/src/cmdlfem410x.c index ecb252ffc..145392eb7 100644 --- a/client/src/cmdlfem410x.c +++ b/client/src/cmdlfem410x.c @@ -108,6 +108,8 @@ static void em410x_construct_emul_graph(uint8_t *uid, uint8_t clock, uint8_t gap // print 64 bit EM410x ID in multiple formats void printEM410x(uint32_t hi, uint64_t id, bool verbose, int type) { + if (!id && !hi) return; + if (verbose == false) { if (type & 0x1) { // Short ID PrintAndLogEx(SUCCESS, "EM 410x ID "_GREEN_("%010" PRIX64), id); @@ -252,6 +254,11 @@ static int ask_em410x_binary_decode(bool verbose, uint32_t *hi, uint64_t *lo, ui return PM3_ESOFT; } + if (!lo && !hi) { + PrintAndLogEx(DEBUG, "DEBUG: Error - Em410x decoded to all zeros"); + return PM3_ESOFT; + } + PrintAndLogEx(DEBUG, "DEBUG: Em410x idx: %zu, Len: %zu, Printing DemodBuffer:", *idx, *size); if (g_debugMode) { printDemodBuff(0, false, false, true);