-
Notifications
You must be signed in to change notification settings - Fork 721
Fix read overflow #1812
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
base: dev
Are you sure you want to change the base?
Fix read overflow #1812
Changes from 2 commits
297891a
3ec7718
41b3812
b342d18
3d45189
0f94331
e1c57c9
677d69f
4891427
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,13 @@ namespace pcpp | |
|
||
void RawPacket::insertData(int atIndex, const uint8_t* dataToInsert, size_t dataToInsertLen) | ||
{ | ||
// Check for overflow in the new length | ||
if ((size_t)m_RawDataLen + dataToInsertLen < (size_t)m_RawDataLen) | ||
{ | ||
PCPP_LOG_ERROR("RawPacket::insertData: dataToInsertLen causes overflow"); | ||
return; | ||
} | ||
|
||
|
||
// memmove copies data as if there was an intermediate buffer in between - so it allows for copying processes on | ||
// overlapping src/dest ptrs if insertData is called with atIndex == m_RawDataLen, then no data is being moved. | ||
// The data of the raw packet is still extended by dataToInsertLen | ||
|
Uh oh!
There was an error while loading. Please reload this page.