mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-16 13:04:55 +03:00
proxy: guard coap_proxy_get_add_list_entry() against two NULL sessions
`coap_proxy_get_add_list_entry(incoming, ongoing, ...)` dereferences `ongoing->context` when `incoming == NULL`. Current in-tree callers always pass exactly one non-NULL session, but the function is a public-ish internal helper and a future caller passing both NULL would dereference NULL immediately. cppcheck flags exactly this (`nullPointer` on `ongoing`). This adds an explicit early `return NULL` when both arguments are NULL - defensive only, no behavior change for existing callers. Signed-off-by: warter666 <121139223+Warterkk@users.noreply.github.com>
This commit is contained in:
1 parent
f6b20b0d3d
commit
53e1bcaeba
1 file changed
+2
@@ -381,6 +381,8 @@ static coap_proxy_entry_t *
|
||||
coap_proxy_get_add_list_entry(coap_session_t *incoming, coap_session_t *ongoing,
|
||||
coap_uri_t uri, coap_proxy_server_list_t *server_list,
|
||||
int allow_add) {
|
||||
if (!incoming && !ongoing)
|
||||
return NULL;
|
||||
coap_context_t *context = incoming ? incoming->context : ongoing->context;
|
||||
coap_proxy_entry_t *proxy_list = context->proxy_list;
|
||||
size_t proxy_list_count = context->proxy_list_count;
|
||||
|
||||
Reference in new issue
Block a user