Skip to content

Commit

Permalink
Merge branch 'dev' into clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
tigercosmos authored Jan 7, 2025
2 parents 70a5233 + 7898a5d commit a8779e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
20 changes: 14 additions & 6 deletions 3rdParty/LightPcapNg/LightPcapNg/src/light_pcapng.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ void parse_by_block_type(struct _light_pcapng *current, const uint32_t *local_da
switch (current->block_type)
{
case LIGHT_SECTION_HEADER_BLOCK:
{
{ // PCPP patch
DPRINT_HERE(LIGHT_SECTION_HEADER_BLOCK);
struct _light_section_header *shb = calloc(1, sizeof(struct _light_section_header));
struct _light_option *opt = NULL;
uint32_t version;
int32_t local_offset;
uint32_t version = 0;
int32_t local_offset = 0;

shb->byteorder_magic = *local_data++;
// TODO check byte order.
Expand All @@ -108,30 +108,34 @@ void parse_by_block_type(struct _light_pcapng *current, const uint32_t *local_da
current->block_body = (uint32_t*)shb;
local_offset = (size_t)local_data - (size_t)block_start;
opt = __parse_options((uint32_t **)&local_data, current->block_total_length - local_offset - sizeof(current->block_total_length));
if (opt == NULL)
opt = calloc(1, sizeof(struct _light_option));
current->options = opt;
}
break;

case LIGHT_INTERFACE_BLOCK:
{
{ // PCPP patch
DPRINT_HERE(LIGHT_INTERFACE_BLOCK);
struct _light_interface_description_block *idb = calloc(1, sizeof(struct _light_interface_description_block));
struct _light_option *opt = NULL;
uint32_t link_reserved = *local_data++;
int32_t local_offset;
int32_t local_offset = 0;

idb->link_type = link_reserved & 0xFFFF;
idb->reserved = (link_reserved >> 16) & 0xFFFF;
idb->snapshot_length = *local_data++;
current->block_body = (uint32_t*)idb;
local_offset = (size_t)local_data - (size_t)block_start;
opt = __parse_options((uint32_t **)&local_data, current->block_total_length - local_offset - sizeof(current->block_total_length));
if (opt == NULL)
opt = calloc(1, sizeof(struct _light_option));
current->options = opt;
}
break;

case LIGHT_ENHANCED_PACKET_BLOCK:
{
{ // PCPP Patch
DPRINT_HERE(LIGHT_ENHANCED_PACKET_BLOCK);
struct _light_enhanced_packet_block *epb = NULL;
struct _light_option *opt = NULL;
Expand All @@ -157,6 +161,8 @@ void parse_by_block_type(struct _light_pcapng *current, const uint32_t *local_da
current->block_body = (uint32_t*)epb;
local_offset = (size_t)local_data - (size_t)block_start;
opt = __parse_options((uint32_t **)&local_data, current->block_total_length - local_offset - sizeof(current->block_total_length));
if (opt == NULL)
opt = calloc(1, sizeof(struct _light_option));
current->options = opt;
}
break;
Expand Down Expand Up @@ -200,6 +206,8 @@ void parse_by_block_type(struct _light_pcapng *current, const uint32_t *local_da
current->block_body = (uint32_t*)cnb;
local_offset = (size_t)local_data - (size_t)block_start;
opt = __parse_options((uint32_t **)&local_data, current->block_total_length - local_offset - sizeof(current->block_total_length));
if (opt == NULL)
opt = calloc(1, sizeof(struct _light_option));
current->options = opt;
}
break;
Expand Down
4 changes: 2 additions & 2 deletions Tests/ExamplesTest/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
attrs==24.2.0
attrs==24.3.0
iniconfig==2.0.0
py==1.11.0
pyparsing==3.1.4
pytest==8.3.3
pytest==8.3.4
scapy==2.6.1
toml==0.10.2

0 comments on commit a8779e0

Please sign in to comment.