mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-08-19 03:37:57 -04:00
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
This commit is contained in:
parent
c14f8d634a
commit
e52b68650f
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue