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.

This commit is contained in:
iceman1001 2016-01-12 23:27:42 +01:00
commit e72d1fbba2

View file

@ -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++;