microbit: BUGFIX Corrected length calculation for validation case

Incorreclty calculated payload bug also addressed here.
This commit is contained in:
Joe Finney 2016-02-03 14:41:45 +00:00
parent 5cb265c158
commit 9d039fd9be

View file

@ -39,7 +39,7 @@ int MicroBitRadioDatagram::recv(uint8_t *buf, int len)
PacketBuffer *p = rxQueue;
rxQueue = rxQueue->next;
int l = min(len, p->length - MICROBIT_RADIO_HEADER_SIZE - 1);
int l = min(len, p->length - (MICROBIT_RADIO_HEADER_SIZE - 1));
// Fill in the buffer provided, if possible.
memcpy(buf, p->payload, l);