Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

SIMPLELINK-CC2640R2-SDK: Host_Test Example does not support receiving subscription notifications of sizes close to 255 bytes

$
0
0

Part Number:SIMPLELINK-CC2640R2-SDK

Hi

The Host_Test example in the latest version of the SIMPLELINK-CC2640R2-SDK fails due to corrupted memory when it tries to receive data from a subscribed characteristic if the data sent back is close to 255 bytes long. This is due to a bug in icall_hci_tl.c in the SDK. The bug happens because after adding the size of the header, it overflows an uint8_t totalLength varialbe and allocates an amount of memory far too small. E.g. Instead of allocating 258 bytes of memory, it allocates 3 bytes then stores the data, which later gets destroyed by allocating that space to something else. This is the offending code in icall_hci_tl.c :

uint8_t totalLength;

// OSAL message header + HCI event header + data
totalLength = sizeof(hciPacket_t) + HCI_EVENT_MIN_LENGTH + dataLen;

// allocate memory for OSAL hdr + packet
msg = (hciPacket_t *)ICall_allocMsg(totalLength);

To fix this simply increase the size of totalLength to be a uint16_t instead, i.e:

uint16_t totalLength;

// OSAL message header + HCI event header + data
totalLength = sizeof(hciPacket_t) + HCI_EVENT_MIN_LENGTH + dataLen;

// allocate memory for OSAL hdr + packet
msg = (hciPacket_t *)ICall_allocMsg(totalLength);

Please can you put this fix into the SDK,

Thanks very much,

Dan


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>