Skip to content

Commit 3595c09

Browse files
committed
Fix vuln OSV-2024-953
1 parent f81ced2 commit 3595c09

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

3rdParty/LightPcapNg/LightPcapNg/src/light_pcapng.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,17 @@ void light_read_record(light_file fd, light_pcapng *record)
304304
uint32_t blockType, blockSize, bytesRead;
305305
bytesRead = light_read(fd, &blockType, sizeof(blockType));
306306
if (bytesRead != sizeof(blockType) || (bytesRead == EOF && feof(fd->file)))
307+
{
308+
current = NULL;
309+
return;
310+
}
311+
312+
// Validate block size
313+
bytesRead = light_read(fd, &blockSize, sizeof(blockSize));
314+
if (blockSize > UINT32_MAX || blockSize < sizeof(blockType)) {
315+
fprintf(stderr, "Invalid block size detected\n");
316+
return;
317+
}
307318
{
308319
current = NULL;
309320
return;

0 commit comments

Comments
 (0)