From e72d1fbba2281c5868c3cf6b9a93b4faaf18c2a7 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 12 Jan 2016 23:27:42 +0100 Subject: [PATCH 1/1] FIX: Coverity, CID#121314, Explicit null dereferenced, in really odd occasions buf would be NULL, and sending NULL to memcpy dereferences it. Not sure about this fix. --- client/cmdhfmf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 7736b9c5..cde20d79 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -2052,6 +2052,11 @@ int CmdHF14AMfSniff(const char *Cmd){ bufsize = traceLen; memset(buf, 0x00, traceLen); } + if (bufPtr == NULL) { + PrintAndLog("Cannot allocate memory for trace"); + free(buf); + return 2; + } memcpy(bufPtr, resp.d.asBytes, len); bufPtr += len; pckNum++; -- 2.39.2