diff --git a/client/src/cmdhfmfhard.c b/client/src/cmdhfmfhard.c index 78971eb01c..5b02d7c9fd 100644 --- a/client/src/cmdhfmfhard.c +++ b/client/src/cmdhfmfhard.c @@ -1565,18 +1565,8 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_ FILE *fnonces = NULL; // init to ZERO - PacketResponseNG resp = { - .cmd = 0, - .length = 0, - .magic = 0, - .status = 0, - .crc = 0, - .ng = false, - }; - resp.oldarg[0] = 0; - resp.oldarg[1] = 0; - resp.oldarg[2] = 0; - memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE); + PacketResponseNG resp; + memset(&resp, 0, sizeof(resp)); uint8_t write_buf[9]; char progress_text[80]; diff --git a/client/src/cmdlf.c b/client/src/cmdlf.c index 59998bc925..a5fd678c2a 100644 --- a/client/src/cmdlf.c +++ b/client/src/cmdlf.c @@ -426,18 +426,9 @@ int CmdLFCommandRead(const char *Cmd) { clearCommandBuffer(); SendCommandNG(CMD_LF_MOD_THEN_ACQ_RAW_ADC, (uint8_t *)&payload, PAYLOAD_HEADER_SIZE + cmd_len + 1); - PacketResponseNG resp; // init to ZERO - resp.cmd = 0, - resp.length = 0, - resp.magic = 0, - resp.status = 0, - resp.crc = 0, - resp.ng = false, - resp.oldarg[0] = 0; - resp.oldarg[1] = 0; - resp.oldarg[2] = 0; - memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE); + PacketResponseNG resp; + memset(&resp, 0, sizeof(resp)); i = 10; // 20sec wait loop diff --git a/client/src/cmdlfem4x50.c b/client/src/cmdlfem4x50.c index aa128b53a1..bb9b1d162f 100644 --- a/client/src/cmdlfem4x50.c +++ b/client/src/cmdlfem4x50.c @@ -1259,18 +1259,9 @@ static int CmdEM4x50Sim(const char *Cmd) { PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or " _GREEN_("") " to abort simulation"); - PacketResponseNG resp; // init to ZERO - resp.cmd = 0, - resp.length = 0, - resp.magic = 0, - resp.status = 0, - resp.crc = 0, - resp.ng = false, - resp.oldarg[0] = 0; - resp.oldarg[1] = 0; - resp.oldarg[2] = 0; - memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE); + PacketResponseNG resp; + memset(&resp, 0, sizeof(resp)); bool keypress; do { diff --git a/client/src/comms.c b/client/src/comms.c index 21e63402c7..5a11c2efa4 100644 --- a/client/src/comms.c +++ b/client/src/comms.c @@ -1030,18 +1030,9 @@ size_t WaitForRawDataTimeout(uint8_t *buffer, size_t len, size_t ms_timeout, boo */ bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms_timeout, bool show_warning) { - PacketResponseNG resp; // init to ZERO - resp.cmd = 0, - resp.length = 0, - resp.magic = 0, - resp.status = 0, - resp.crc = 0, - resp.ng = false, - resp.oldarg[0] = 0; - resp.oldarg[1] = 0; - resp.oldarg[2] = 0; - memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE); + PacketResponseNG resp; + memset(&resp, 0, sizeof(resp)); if (response == NULL) { response = &resp; @@ -1118,23 +1109,14 @@ bool GetFromDevice(DeviceMemType_t memtype, uint8_t *dest, uint32_t bytes, uint3 if (dest == NULL) return false; + // init to ZERO PacketResponseNG resp; + memset(&resp, 0, sizeof(resp)); + if (response == NULL) { response = &resp; } - // init to ZERO - resp.cmd = 0, - resp.length = 0, - resp.magic = 0, - resp.status = 0, - resp.crc = 0, - resp.ng = false, - resp.oldarg[0] = 0; - resp.oldarg[1] = 0; - resp.oldarg[2] = 0; - memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE); - if (bytes == 0) return true;