Skip to content
Commit 8a0dc430 authored by Robert Lubos's avatar Robert Lubos Committed by Anas Nashif
Browse files

net: context: Do not overflow net_pkt when using msghdr



If data for `context_sendto()` was provided in a form of
`struct msghdr` (for instance via `sendmsg()`), it was not verified that
the provided data would actually fit into allocated net_pkt. In result,
and error could be returned in case the provided data was larger than
net_pkt allows.

Fix this, by verifying the remaining buffer length when iterating over
`struct msghdr`. Once the buffer is filled up, break the loop. In
result, functions like `sendmsg()` will return the actual length of data
sent instead of an error.

Signed-off-by: default avatarRobert Lubos <robert.lubos@nordicsemi.no>
parent e6638715
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment