Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: lib: coap: Handle truncated messages in CoAP server #83758

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pdgendt
Copy link
Collaborator

@pdgendt pdgendt commented Jan 9, 2025

If the CoAP server receives a message that doesn't fit into the receive buffer, we should stop processing the message and respond to the client with 4.13 "Request Entity too large".

Fixes #83735

Copy link
Member

@martinjaeger martinjaeger left a comment

Choose a reason for hiding this comment

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

Thanks again for the fix.

I will test the code tomorrow. Some initial comments below.

subsys/net/lib/coap/coap_server.c Show resolved Hide resolved
subsys/net/lib/coap/coap_server.c Outdated Show resolved Hide resolved
@pdgendt pdgendt force-pushed the coap-server-trunc branch from 504b0b0 to 8451b86 Compare January 9, 2025 18:47
jukkar
jukkar previously approved these changes Jan 10, 2025
Copy link
Contributor

@rlubos rlubos left a comment

Choose a reason for hiding this comment

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

Generally looks good, one request though.

subsys/net/lib/coap/coap_server.c Outdated Show resolved Hide resolved
If the CoAP server receives a message that doesn't fit into the receive
buffer, we should stop processing the message and respond to the client
with 4.13 "Request Entity too large".

Signed-off-by: Pieter De Gendt <[email protected]>
Copy link
Contributor

@rlubos rlubos left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@martinjaeger martinjaeger left a comment

Choose a reason for hiding this comment

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

Works great.

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

Successfully merging this pull request may close these issues.

CoAP server should not silently truncate too long requests
5 participants