From d9850cf0f649679db4a3da50388af74d2fe8d595 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Tue, 25 Oct 2016 16:31:15 -0600 Subject: [PATCH] nrf8001: fix potential reference of uninitialized memory Signed-off-by: Jon Trulson --- src/nrf8001/hal_aci_tl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nrf8001/hal_aci_tl.cpp b/src/nrf8001/hal_aci_tl.cpp index 84d0865f..07fdbe85 100644 --- a/src/nrf8001/hal_aci_tl.cpp +++ b/src/nrf8001/hal_aci_tl.cpp @@ -233,10 +233,10 @@ static bool m_aci_spi_transfer(hal_aci_data_t * data_to_send, hal_aci_data_t * r max_bytes = HAL_ACI_MAX_LENGTH; } - // Transmit/receive the rest of the packet - for (byte_cnt = 0; byte_cnt < max_bytes; byte_cnt++) + // Transmit/receive the rest of the packet (skip first byte - cmd) + for (byte_cnt = 1; byte_cnt < max_bytes; byte_cnt++) { - received_data->buffer[byte_cnt+1] = spi_readwrite(data_to_send->buffer[byte_sent_cnt++]); + received_data->buffer[byte_cnt] = spi_readwrite(data_to_send->buffer[byte_sent_cnt++]); } // RDYN should follow the REQN line in approx 100ns