-
Notifications
You must be signed in to change notification settings - Fork 10
Fix buffer overflow in Vlan_SetMacAddr from int/ULONG type mismatch #28
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
Conversation
Co-authored-by: guto86 <115101745+guto86@users.noreply.github.com>
|
b'## Copyright scan failure |
Change 'add' variable from int to ULONG to match the expected type in Vlan_GetEthLinkMacOffSet. This prevents memory corruption where 8 bytes were written to a 4-byte int variable, overwriting adjacent memory (the 'number' variable). Co-authored-by: guto86 <115101745+guto86@users.noreply.github.com>
Co-authored-by: guto86 <115101745+guto86@users.noreply.github.com>
|
b'## Copyright scan failure |
|
b'## Copyright scan failure |
|
b'## Copyright scan failure |
|
b'## Copyright scan failure |
|
b'## Copyright scan failure |
S-Parthiban-Selvaraj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove temporary files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a critical buffer overflow vulnerability in Vlan_SetMacAddr caused by a type mismatch. The add variable was declared as int (4 bytes) but passed by reference to a function expecting ULONG* (8 bytes on 64-bit systems), causing memory corruption of adjacent variables.
Key changes:
- Changed
addvariable type frominttoULONGto match the expected function signature - Removed unnecessary cast from
(PULONG)&addto&add
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| source/TR-181/middle_layer_src/vlan_apis.c | Fixed type mismatch by changing add from int to ULONG and removed unnecessary cast |
| cfg/missing | Added GNU automake utility script (build infrastructure) |
| cfg/install-sh | Added GNU install script (build infrastructure) |
| cfg/depcomp | Added dependency tracking script (build infrastructure) |
| _codeql_detected_source_root | Added CodeQL source root marker file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The
Vlan_SetMacAddrfunction declaresaddasintbut casts it toULONG*when callingVlan_GetEthLinkMacOffSet. On 64-bit systems, this writes 8 bytes to a 4-byte location, corrupting the adjacentnumbervariable.Example impact:
00:33:44:22:00:88→number = 0x3344220088Vlan_GetEthLinkMacOffSet(pEntry, (PULONG)&add)with offset 0numbercorrupted to0x3300000000(lower 4 bytes overwritten)Changes:
addfrominttoULONGto match function signature(PULONG)&addto&addWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
esm.ubuntu.com/usr/lib/apt/methods/https(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.