From e52b68650f6bc790ed118d391f579f84e33c0c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20=C3=85gren?= Date: Wed, 9 Apr 2025 12:38:04 +0200 Subject: [PATCH] check fix: Prevent SPI write if tx_buf is or tx_size is 0 To avoid NULL pointer access if tx_buf is NULL but tx_size is not 0 --- hw/application_fpga/fw/tk1/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/application_fpga/fw/tk1/spi.c b/hw/application_fpga/fw/tk1/spi.c index c40a64f..e415923 100644 --- a/hw/application_fpga/fw/tk1/spi.c +++ b/hw/application_fpga/fw/tk1/spi.c @@ -76,7 +76,7 @@ int spi_transfer(uint8_t *cmd, size_t cmd_size, uint8_t *tx_buf, size_t tx_size, spi_write(cmd, cmd_size); - if (tx_buf != NULL || tx_size != 0) { + if (tx_buf != NULL && tx_size != 0) { spi_write(tx_buf, tx_size); }