add NULL checks
This commit is contained in:
1 parent
7eb4ecb332
commit
4024639e5d
1 file changed
+26
@@ -455,6 +455,13 @@ int do_iclass_simulation(int simulationMode, uint8_t *reader_mac_buf) {
|
||||
// receive command
|
||||
uint8_t *receivedCmd = BigBuf_calloc(MAX_FRAME_SIZE);
|
||||
|
||||
if (resp_anticoll == NULL || resp_csn == NULL || resp_conf == NULL || resp_cc == NULL ||
|
||||
resp_ff == NULL || resp_aia == NULL || receivedCmd == NULL) {
|
||||
if (g_dbglevel >= DBG_ERROR) DbpString("iClass sim: failed to allocate buffers");
|
||||
BigBuf_free_keep_EM();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Prepare card messages
|
||||
tosend_t *ts = get_tosend();
|
||||
|
||||
@@ -501,6 +508,12 @@ int do_iclass_simulation(int simulationMode, uint8_t *reader_mac_buf) {
|
||||
//Each bit is doubled when modulated for FPGA, and we also have SOF and EOF (2 bytes)
|
||||
uint8_t *data_response = BigBuf_calloc((34 * 2) + 3);
|
||||
|
||||
if (data_generic_trace == NULL || data_response == NULL) {
|
||||
if (g_dbglevel >= DBG_ERROR) DbpString("iClass sim: failed to allocate buffers");
|
||||
BigBuf_free_keep_EM();
|
||||
return true;
|
||||
}
|
||||
|
||||
enum { IDLE, ACTIVATED, SELECTED, HALTED } chip_state = IDLE;
|
||||
|
||||
bool button_pressed = false;
|
||||
@@ -1098,6 +1111,13 @@ int do_iclass_simulation_nonsec(void) {
|
||||
// receive command
|
||||
uint8_t *receivedCmd = BigBuf_calloc(MAX_FRAME_SIZE);
|
||||
|
||||
if (resp_anticoll == NULL || resp_csn == NULL || resp_conf == NULL ||
|
||||
resp_aia == NULL || receivedCmd == NULL) {
|
||||
if (g_dbglevel >= DBG_ERROR) DbpString("iClass sim nonsec: failed to allocate buffers");
|
||||
BigBuf_free_keep_EM();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Prepare card messages
|
||||
tosend_t *ts = get_tosend();
|
||||
ts->max = 0;
|
||||
@@ -1135,6 +1155,12 @@ int do_iclass_simulation_nonsec(void) {
|
||||
//Each bit is doubled when modulated for FPGA, and we also have SOF and EOF (2 bytes)
|
||||
uint8_t *data_response = BigBuf_calloc((32 + 2) * 2 + 2);
|
||||
|
||||
if (data_generic_trace == NULL || data_response == NULL) {
|
||||
if (g_dbglevel >= DBG_ERROR) DbpString("iClass sim nonsec: failed to allocate buffers");
|
||||
BigBuf_free_keep_EM();
|
||||
return true;
|
||||
}
|
||||
|
||||
enum { IDLE, ACTIVATED, SELECTED, HALTED } chip_state = IDLE;
|
||||
|
||||
bool button_pressed = false;
|
||||
|
||||
Reference in new issue
Block a user