coap_net.c: Fix TCP boundary read condition

Increment session->partial_read correctly.
This commit is contained in:
Jon Shallow committed 2025-09-15 17:20:42 +01:00
1 parent 7cf7465b78
commit ba90416186
1 file changed
+4 -1
+4 -1
View File
@@ -2186,6 +2186,7 @@ coap_read_session(coap_context_t *ctx, coap_session_t *session, coap_tick_t now)
p += n;
bytes_read -= n;
if (n == len) {
/* Header now all in */
size_t size = coap_pdu_parse_size(session->proto, session->read_header,
hdr_size + tok_ext_bytes);
if (size > COAP_DEFAULT_MAX_PDU_RX_SIZE) {
@@ -2219,9 +2220,11 @@ coap_read_session(coap_context_t *ctx, coap_session_t *session, coap_tick_t now)
session->partial_read = 0;
}
} else {
session->partial_read += bytes_read;
/* More of the header to go */
session->partial_read += n;
}
} else {
/* Get in first byte of the header */
session->read_header[0] = *p++;
bytes_read -= 1;
if (!coap_pdu_parse_header_size(session->proto,