From 5b5b6972ec3176bee25529a51b1b1db87dda7e46 Mon Sep 17 00:00:00 2001 From: Lucien Zuercher Date: Thu, 19 Mar 2026 15:49:24 +0200 Subject: [PATCH] fix: do not override sequence counter after window processing --- src/coap_oscore.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/coap_oscore.c b/src/coap_oscore.c index 4e065e0b..2eafae2a 100644 --- a/src/coap_oscore.c +++ b/src/coap_oscore.c @@ -1122,10 +1122,11 @@ coap_oscore_decrypt_pdu(coap_session_t *session, 0); goto error_no_ack; } - - incoming_seq = - coap_decode_var_bytes8(cose->partial_iv.s, cose->partial_iv.length); - rcp_ctx->last_seq = incoming_seq; + if (rcp_ctx->initial_state == 1) { + incoming_seq = + coap_decode_var_bytes8(cose->partial_iv.s, cose->partial_iv.length); + rcp_ctx->last_seq = incoming_seq; + } } else { /* !coap_request */ /* * 8.4 Step 2