Fix network control handler to ensure proper offset calculation and prevent buffer overrun - #1387
Merged
skarg merged 8 commits intoJun 16, 2026
Merged
Conversation
…revent buffer overrun
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the router demo applications’ network_control_handler() parsing of NETWORK_MESSAGE_INIT_RT_TABLE to correctly maintain the running offset while iterating a received routing table list, aiming to avoid incorrect offset resets and reduce risk of out-of-bounds access during NPDU parsing.
Changes:
- Move the
ioffset initialization outside the per-entry loop so it advances across entries instead of resetting each iteration. - Simplify entry skipping to
i += 4 + PortInfoLenand add a minimal header-length guard before decoding fields.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/router-mstp/main.c | Fixes INIT-RT-TABLE list parsing offset handling and adds a basic minimum-length check. |
| apps/router-ipv6/main.c | Applies the same INIT-RT-TABLE list parsing offset fix and basic minimum-length check. |
…length and adjusting offsets
…s for I-Am-Router and Init Routing Table messages, improving code clarity and maintainability.
…ipv6-demo-app-out-of-bounds-read
…ve function call clarity
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…NPDU data. Fix npdu_init_routing_table_process() overrun.
skarg
added a commit
that referenced
this pull request
Jun 26, 2026
…revent buffer overrun (#1387) * Fix out-of-bounds read in network control handler by validating NPDU length and adjusting offsets * Refactor network control handler to use dedicated processing functions for I-Am-Router and Init Routing Table messages, improving code clarity and maintainability.
skarg
added a commit
that referenced
this pull request
Jul 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.