diff --git a/libnfc/chips/pn53x-internal.h b/libnfc/chips/pn53x-internal.h index 34e6ece..1272891 100644 --- a/libnfc/chips/pn53x-internal.h +++ b/libnfc/chips/pn53x-internal.h @@ -112,10 +112,10 @@ * Start bytes, packet length, length checksum, direction, packet checksum and postamble are overhead */ // The TFI is considered part of the overhead -# define PN53x_NORMAL_FRAME__DATA_MAX_LEN 254 -# define PN53x_NORMAL_FRAME__OVERHEAD 8 -# define PN53x_EXTENDED_FRAME__DATA_MAX_LEN 264 -# define PN53x_EXTENDED_FRAME__OVERHEAD 11 +# define PN53x_NORMAL_FRAME__DATA_MAX_LEN 254 +# define PN53x_NORMAL_FRAME__OVERHEAD 8 +# define PN53x_EXTENDED_FRAME__DATA_MAX_LEN 264 +# define PN53x_EXTENDED_FRAME__OVERHEAD 11 # define PN53x_ACK_FRAME__LEN 6 typedef struct { diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index 51d5dbf..9688441 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -294,8 +294,8 @@ typedef enum { PTM_ISO14443_4_PICC_ONLY = 0x04 } pn53x_target_mode; -extern const uint8_t pn53x_ack_frame[6]; -extern const uint8_t pn53x_nack_frame[6]; +extern const uint8_t pn53x_ack_frame[PN53x_ACK_FRAME__LEN]; +extern const uint8_t pn53x_nack_frame[PN53x_ACK_FRAME__LEN]; int pn53x_init(struct nfc_device *pnd); int pn53x_transceive(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRxLen, int timeout); diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index 59263e9..b8c832c 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -337,7 +337,7 @@ arygon_tama_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, i return pnd->last_error; } - uint8_t abtRxBuf[6]; + uint8_t abtRxBuf[PN53x_ACK_FRAME__LEN]; if ((res = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, sizeof(abtRxBuf), 0, timeout)) != 0) { log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Unable to read ACK"); pnd->last_error = res; diff --git a/libnfc/drivers/pn532_i2c.c b/libnfc/drivers/pn532_i2c.c index bc25f35..bfd5f3e 100644 --- a/libnfc/drivers/pn532_i2c.c +++ b/libnfc/drivers/pn532_i2c.c @@ -337,7 +337,7 @@ pn532_i2c_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int uint8_t abtRxBuf[PN53x_ACK_FRAME__LEN]; // Wait for the ACK frame - res = pn532_i2c_wait_rdyframe(pnd, abtRxBuf, PN53x_ACK_FRAME__LEN, timeout); + res = pn532_i2c_wait_rdyframe(pnd, abtRxBuf, sizeof(abtRxBuf), timeout); if (res < 0) { if (res == NFC_EOPABORTED) { // Send an ACK frame from host to abort the command. diff --git a/libnfc/drivers/pn532_spi.c b/libnfc/drivers/pn532_spi.c index 639f08d..93ed75e 100644 --- a/libnfc/drivers/pn532_spi.c +++ b/libnfc/drivers/pn532_spi.c @@ -601,8 +601,8 @@ pn532_spi_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int - uint8_t abtRxBuf[6]; - res = spi_send_receive(DRIVER_DATA(pnd)->port, &pn532_spi_cmd_dataread, 1, abtRxBuf, 6, true); + uint8_t abtRxBuf[PN53x_ACK_FRAME__LEN]; + res = spi_send_receive(DRIVER_DATA(pnd)->port, &pn532_spi_cmd_dataread, 1, abtRxBuf, sizeof(abtRxBuf), true); if (res != 0) { log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "Unable to read ACK"); diff --git a/libnfc/drivers/pn532_uart.c b/libnfc/drivers/pn532_uart.c index 1f3294d..2818919 100644 --- a/libnfc/drivers/pn532_uart.c +++ b/libnfc/drivers/pn532_uart.c @@ -334,8 +334,8 @@ pn532_uart_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, in return pnd->last_error; } - uint8_t abtRxBuf[6]; - res = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, 6, 0, timeout); + uint8_t abtRxBuf[PN53x_ACK_FRAME__LEN]; + res = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, sizeof(abtRxBuf), 0, timeout); if (res != 0) { log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "Unable to read ACK"); pnd->last_error = res;