Skip to content

Commit e9d7350

Browse files
authored
Merge pull request #784 from david-cermak/fix/mdns_fuzz_issue
[mdns]: Fix parsing incorrect txt records
2 parents 703c492 + 61da30b commit e9d7350

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

components/mdns/.cz.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ commitizen:
33
bump_message: 'bump(mdns): $current_version -> $new_version'
44
pre_bump_hooks: python ../../ci/changelog.py mdns
55
tag_format: mdns-v$version
6-
version: 1.8.1
6+
version: 1.8.2
77
version_files:
88
- idf_component.yml

components/mdns/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [1.8.2](https://github.com/espressif/esp-protocols/commits/mdns-v1.8.2)
4+
5+
### Bug Fixes
6+
7+
- Fix parsing incorrect txt records ([8fd2c99f](https://github.com/espressif/esp-protocols/commit/8fd2c99f))
8+
39
## [1.8.1](https://github.com/espressif/esp-protocols/commits/mdns-v1.8.1)
410

511
### Bug Fixes

components/mdns/idf_component.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.8.1"
1+
version: "1.8.2"
22
description: "Multicast UDP service used to provide local network service and host discovery."
33
url: "https://github.com/espressif/esp-protocols/tree/master/components/mdns"
44
issues: "https://github.com/espressif/esp-protocols/issues"

components/mdns/mdns.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -3593,7 +3593,7 @@ static void _mdns_result_txt_create(const uint8_t *data, size_t len, mdns_txt_it
35933593
}
35943594

35953595
int name_len = _mdns_txt_item_name_get_len(data + i, partLen);
3596-
if (name_len < 0) {//invalid item (no name)
3596+
if (name_len < 0 || txt_num >= num_items) {//invalid item (no name or more items than expected)
35973597
i += partLen;
35983598
continue;
35993599
}
@@ -3602,7 +3602,6 @@ static void _mdns_result_txt_create(const uint8_t *data, size_t len, mdns_txt_it
36023602
HOOK_MALLOC_FAILED;
36033603
goto handle_error;//error
36043604
}
3605-
36063605
mdns_txt_item_t *t = &txt[txt_num];
36073606
uint8_t *value_len = &txt_value_len[txt_num];
36083607
txt_num++;
@@ -3624,6 +3623,8 @@ static void _mdns_result_txt_create(const uint8_t *data, size_t len, mdns_txt_it
36243623
*value_len = new_value_len;
36253624
i += new_value_len;
36263625
t->value = value;
3626+
} else {
3627+
t->value = NULL;
36273628
}
36283629
}
36293630

0 commit comments

Comments
 (0)