Commit 2f2cb2bb authored by mz-fuzzy's avatar mz-fuzzy

avoid memory corruption when calling RF24::read(0) on linux machines

Signed-off-by: default avatarmz-fuzzy <mzfuzzy800@gmail.com>
parent 4c52feb2
......@@ -290,10 +290,12 @@ uint8_t RF24::read_payload(void* buf, uint8_t data_len)
status = *prx++; // 1st byte is status
while ( --data_len ) // Decrement before to skip 1st status byte
*current++ = *prx++;
if (data_len > 0) {
while ( --data_len ) // Decrement before to skip 1st status byte
*current++ = *prx++;
*current = *prx;
*current = *prx;
}
endTransaction();
#else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment