Skip to content

Commit 74663d6

Browse files
committed
Fix vuln OSV-2024-967
1 parent f81ced2 commit 74663d6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Packet++/src/RawPacket.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ namespace pcpp
113113
}
114114

115115
m_RawData = (uint8_t*)pRawData;
116+
117+
// Validate that the raw data length does not exceed the buffer size
118+
if (rawDataLen < 0 || (m_DeleteRawDataAtDestructor && rawDataLen > sizeof(m_RawData)))
119+
{
120+
PCPP_LOG_ERROR("Invalid raw data length: " << rawDataLen);
121+
return false;
122+
}
123+
116124
m_RawDataLen = rawDataLen;
117125
m_TimeStamp = timestamp;
118126
m_RawPacketSet = true;

0 commit comments

Comments
 (0)