Skip to content

Commit 4d8f4c0

Browse files
Merge branch 'dev' into develop
2 parents 5b18d91 + 3292f14 commit 4d8f4c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+10374
-14605
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ repos:
3838
- id: cppcheck
3939
args: ["--std=c++11", "--language=c++", "--suppressions-list=cppcheckSuppressions.txt", "--inline-suppr", "--force"]
4040
- repo: https://github.com/BlankSpruce/gersemi
41-
rev: 0.17.1
41+
rev: 0.18.2
4242
hooks:
4343
- id: gersemi
4444
args: ["-c"]
4545
- repo: https://github.com/codespell-project/codespell
46-
rev: v2.3.0
46+
rev: v2.4.1
4747
hooks:
4848
- id: codespell
4949
pass_filenames: false
5050
- repo: https://github.com/crate-ci/typos
51-
rev: codespell-dict-v0.5.0
51+
rev: typos-dict-v0.12.4
5252
hooks:
5353
- id: typos
5454
args: ['--config=typos-config.toml']

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,28 @@ static struct _light_option *__parse_options(uint32_t **memory, const int32_t ma
4949
opt->custom_option_code = *local_memory++;
5050
opt->option_length = *local_memory++;
5151

52+
// PCPP patch
53+
// Validate option_length
54+
if (opt->option_length > max_len - 2 * sizeof(*local_memory)) {
55+
free(opt);
56+
return NULL;
57+
}
58+
// PCPP patch end
59+
5260
actual_length = (opt->option_length % alignment) == 0 ?
5361
opt->option_length :
5462
(opt->option_length / alignment + 1) * alignment;
5563

56-
if (actual_length > 0) {
57-
opt->data = calloc(1, actual_length);
58-
memcpy(opt->data, local_memory, actual_length);
59-
local_memory += (sizeof(**memory) / sizeof(*local_memory)) * (actual_length / alignment);
64+
// PCPP patch
65+
// Validate actual_length
66+
if (actual_length <= 0 || actual_length > max_len - 2 * sizeof(*local_memory)) {
67+
free(opt);
68+
return NULL;
6069
}
70+
opt->data = calloc(1, actual_length);
71+
memcpy(opt->data, local_memory, actual_length);
72+
local_memory += (sizeof(**memory) / sizeof(*local_memory)) * (actual_length / alignment);
73+
// PCPP patch end
6174

6275
*memory = (uint32_t*)local_memory;
6376
remaining_size = max_len - actual_length - 2 * sizeof(*local_memory);

0 commit comments

Comments
 (0)