This repository was archived by the owner on Nov 10, 2021. It is now read-only.

Description
|
oc_endpoint_t *endpoint = oc_memb_alloc(&oc_endpoints_s); |
And potentially other places that involve oc_memb_alloc.
Description:
If OC_DYNAMIC_ALLOCATION is disabled, oc_memb_alloc returns a pointer to a part of a statically allocated structure buffer with compile-time defined size. It returns NULL if no more space is available in the buffer. The return value is not checked for validity.
Since we never know how many endpoints will be present in an incoming packet, it is possible to overflow the buffer, causing the code to try to access a NULL pointer.
Proposal:
Add NULL-checks and graceful handle a returned NULL pointer