From 2d26ac724d2caa66fe5072fd02aa38203a701948 Mon Sep 17 00:00:00 2001 From: Troels Jessen Date: Mon, 3 Aug 2026 08:41:21 +0200 Subject: [PATCH] Protection in case of CSP buffer exhaustion --- src/csp_if_cblk.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/csp_if_cblk.c b/src/csp_if_cblk.c index 01dd5d7..beae500 100644 --- a/src/csp_if_cblk.c +++ b/src/csp_if_cblk.c @@ -170,6 +170,11 @@ int csp_if_cblk_rx(csp_iface_t * iface, cblk_frame_t *frame, uint32_t len, uint8 } csp_packet_t* rx_packet = csp_buffer_get(frame_length); + if (!rx_packet) { + iface->rx_error++; + return CSP_ERR_NOBUFS; + } + csp_id_setup_rx(rx_packet); if (frame->hdr.nacl_crypto_key > 0) {