From c4e6601944c343aa8367a93a5dd57ba077994a2c Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Wed, 18 Apr 2018 12:01:46 +0200 Subject: [PATCH] net.c: fix PDU find bug in coap_remove_from_queue() Issue #163 [1] points out that coap_remove_from_queue() may release the wrong PDU from the retransmit queue due to a false hit in the do/while loop. This change was proposed by hongnguyen-tma to fix this issue. [1] https://github.com/obgm/libcoap/issues/163 --- src/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net.c b/src/net.c index d4bde894..d9f5db5f 100644 --- a/src/net.c +++ b/src/net.c @@ -1310,7 +1310,7 @@ coap_remove_from_queue(coap_queue_t **queue, coap_session_t *session, coap_tid_t do { p = q; q = q->next; - } while (q && session != q->session && id != q->id); + } while (q && (session != q->session || id != q->id)); if (q) { /* found transaction */ p->next = q->next;