Skip to content

Conversation

@rlubos
Copy link
Contributor

@rlubos rlubos commented Jul 18, 2023

In case upper layer does not follow the convention, and the net_pkt provided to the nRF 15.4 driver had a payload larger than the maximum payload size of an individual 15.4 frame, the driver would end up with buffer overflow.

Fix this by adding an extra payload_len check before attempting to copy the payload to the internal buffer.

In case upper layer does not follow the convention, and the net_pkt
provided to the nRF 15.4 driver had a payload larger than the maximum
payload size of an individual 15.4 frame, the driver would end up with
buffer overflow.

Fix this by adding an extra payload_len check before attempting to copy
the payload to the internal buffer.

Signed-off-by: Robert Lubos <[email protected]>
@rlubos rlubos requested a review from jciupis as a code owner July 18, 2023 14:04
@rlubos rlubos requested a review from jukkar July 18, 2023 14:05
@zephyrbot zephyrbot requested review from a user, cfriedt and tbursztyka July 18, 2023 14:05
@rlubos
Copy link
Contributor Author

rlubos commented Jul 18, 2023

CC @ankuns @ahasztag

jukkar
jukkar previously approved these changes Jul 18, 2023
ghost
ghost previously approved these changes Jul 18, 2023
uint8_t *payload = frag->data;
bool ret = true;

if (payload_len > NRF5_PSDU_LENGTH) {
Copy link

Choose a reason for hiding this comment

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

Maybe this is a good opportunity to switch to IEEE802154_MTU instead everywhere and remove that custom constant which seems to be redundant? (of course not required at all - just an idea)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed the redefined constants and switched to use symbols defined in ieee802154.h header, where applicable in the driver.

jciupis
jciupis previously approved these changes Jul 19, 2023
Use generic symbols defined in ieee802154.h for packet/FCS size instead
of redefining them in the driver header.

Signed-off-by: Robert Lubos <[email protected]>
@rlubos rlubos dismissed stale reviews from jciupis, ghost , and jukkar via 57450d6 July 19, 2023 07:17
@rlubos rlubos requested review from a user, jciupis and jukkar July 19, 2023 07:17
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Nice, you found even more constants, that can be replaced. Looks good!

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.

8 participants