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
This commit is contained in:
Olaf Bergmann committed 2018-04-18 12:01:46 +02:00
1 parent 8c35e7625b
commit c4e6601944
1 file changed
+1 -1
+1 -1
View File
@@ -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;