openthread / ot-commissioner

OpenThread Commissioner, a Thread commissioner for joining new Thread devices and managing Thread networks.
https://openthread.io/
BSD 3-Clause "New" or "Revised" License
49 stars 36 forks source link

[coap] handle zero coap token length #286

Closed wgtdkp closed 1 month ago

wgtdkp commented 1 month ago

There could be potential out of bound error if the token length in CoAP header is zero (&aBuf[offset] could be referring to the next element after the end of the buffer).

Note that the added test can pass without the fix in coap.cpp but it's probably because the toolchain has some optimization to avoid such issues...