Skip to content

dtls.c: add missing length checks in dtls_prepare_record. - #275

Open
boaks wants to merge 1 commit into
eclipse-tinydtls:mainfrom
boaks:fix_oob_write_sendbuffer
Open

dtls.c: add missing length checks in dtls_prepare_record.#275
boaks wants to merge 1 commit into
eclipse-tinydtls:mainfrom
boaks:fix_oob_write_sendbuffer

Conversation

@boaks

@boaks boaks commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Achim Kraus <achim.kraus@cloudcoap.net>
Comment thread dtls.c
} CCMNonceExample;
*/

if (*rlen < DTLS_RH_LENGTH + 8) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have difficulties wrapping my head around this length check. The storage space for the 8 bytes written after this check are already included in DTLS_RH_LENGTH. Which fields are checked here actually?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a fast look, it seems that this is already considered in line 1680 with

 if (*rlen < DTLS_RH_LENGTH) {

but the pain comes from the use of epoch+record-sequence-number as explicit nonce.
Therefore I check, if there is space for the 8 bytes of the explicit nonce. These bytes are located direct after the header.

Does this help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants