1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 22:43:50 +01:00

Merge pull request #21227 from maribu/sys/net/nanocoap/fix-nullptr-deref

sys/net/nanocoap: fix dereferencing a null pointer
This commit is contained in:
benpicco 2025-02-19 11:38:05 +00:00 committed by GitHub
commit 90a9ddb2c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -528,7 +528,8 @@ ssize_t coap_handle_req(coap_pkt_t *pkt, uint8_t *resp_buf, unsigned resp_buf_le
if (retval < 0) {
/* handlers were not able to process this, so we reply with a RST,
* unless we got a multicast message */
if (!sock_udp_ep_is_multicast(coap_request_ctx_get_local_udp(ctx))) {
const sock_udp_ep_t *local = coap_request_ctx_get_local_udp(ctx);
if (!local || !sock_udp_ep_is_multicast(local)) {
return coap_build_reply(pkt, COAP_CODE_EMPTY, resp_buf, resp_buf_len, 0);
}
}