-
Notifications
You must be signed in to change notification settings - Fork 684
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
Fix vuln OSV-2024-382 #1698
base: dev
Are you sure you want to change the base?
Fix vuln OSV-2024-382 #1698
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1698 +/- ##
==========================================
- Coverage 83.16% 83.09% -0.08%
==========================================
Files 277 277
Lines 48193 48210 +17
Branches 9966 10161 +195
==========================================
- Hits 40081 40060 -21
- Misses 7234 7263 +29
- Partials 878 887 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -151,6 +161,11 @@ namespace pcpp | |||
void UdpLayer::computeCalculateFields() | |||
{ | |||
udphdr* udpHdr = (udphdr*)m_Data; | |||
if (m_DataLen < sizeof(udphdr)) |
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.
let's move this line at the beginning.
[Warning] This PR is generated by AI
Pull Request Description
PR Title: Fix for Vulnerability in PcapPlusPlus - OSV-2024-382
PR Description:
UdpLayer
class, where functions were accessing data beyond the bounds of the allocated buffer. This occurred when the buffer size was insufficient for operations involving UDP header fields, leading to a heap-buffer-overflow. The issue was reported in the OSV-2024-382 vulnerability report.getSrcPort()
: Ensures that the buffer length is sufficient before accessing the source port.getDstPort()
: Ensures that the buffer length is sufficient before accessing the destination port.computeCalculateFields()
: Ensures that the buffer length is sufficient before performing length and checksum calculations.These changes ensure that unsafe memory access is avoided, improving both the security and stability of the program.
Sanitizer Report Summary:
UdpLayer
class while accessing UDP header fields. The root cause was the lack of bounds checking before accessing these fields, leading to out-of-bounds memory access.Full Sanitizer Report:
Files Modified:
Packet++/src/UdpLayer.cpp
Patch Validation: The patch has been validated and confirmed to resolve the issue identified in the sanitizer report. No new bugs were introduced.
Links: