Open pawszw2 opened 2 months ago
Thanks for raising this. It would be good to know which coap_malloc_type()
failed for you (file and line no). In the OSCORE specific code, NULL returns are checked for (otherwise you will be seeing memory access errors), but they may be taking wrong decisions.
See #1546 updates to Zephyr to help track which coap_malloc_type()
is failing for you.
Environment
libcoap Configuration Summary
Irrelevant
Problem Description
Hi! When I was using libcoap with OSCORE, I run into a problem of unsuccessful encryption (server returned 4.01 Unauthorized). After some investigation I've found out that it was due to failed
coap_malloc_type()
and result of allocation not being checked againstNULL
. I think thatNULL
checks should be introduced after eachcoap_malloc_type()
invocation.Expected Behavior
Error log with information, that memory allocation failed, and 5.xx (probably 5.00) error code returned.
Actual Behavior
No information about failed allocation and wrong error code (4.01 suggesting an error on client's side).
Steps to reproduce
NULLchecks after allocation are missing in many places, so it requires many scenarios.
I also don't know if server returns 5.00 after memory allocation in places we check it.
Code to reproduce this issue
Debug Logs
Other items if possible