block.c: Correct size of allocated PDU buffer

Fix potential buffer overrun corruptions.
This commit is contained in:
Jon Shallow authored and mrdeep1 committed 2022-08-13 14:19:58 +01:00
1 parent 6a9a787503
commit 3d387a5be4
1 file changed
+1 -2
+1 -2
View File
@@ -676,8 +676,7 @@ coap_add_data_large_internal(coap_session_t *session,
if (!lg_xmit->pdu.token)
goto fail;
lg_xmit->pdu.alloc_size = lg_xmit->pdu.used_size +
lg_xmit->pdu.max_hdr_size;
lg_xmit->pdu.alloc_size = lg_xmit->pdu.used_size;
lg_xmit->pdu.token += lg_xmit->pdu.max_hdr_size;
memcpy(lg_xmit->pdu.token, pdu->token, lg_xmit->pdu.used_size);
if (pdu->data)