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:
@@ -2052,6 +2052,11 @@ int CmdHF14AMfSniff(const char *Cmd){
|
|||||||
bufsize = traceLen;
|
bufsize = traceLen;
|
||||||
memset(buf, 0x00, traceLen);
|
memset(buf, 0x00, traceLen);
|
||||||
}
|
}
|
||||||
|
if (bufPtr == NULL) {
|
||||||
|
PrintAndLog("Cannot allocate memory for trace");
|
||||||
|
free(buf);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
memcpy(bufPtr, resp.d.asBytes, len);
|
memcpy(bufPtr, resp.d.asBytes, len);
|
||||||
bufPtr += len;
|
bufPtr += len;
|
||||||
pckNum++;
|
pckNum++;
|
||||||
|
|||||||
Reference in New Issue
Block a user