mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-06-25 17:31:33 +02:00
fix(mdns): Fix memory issues reported by valgrind
* Read after the allocated area (which may lead to subsequent mdns name corruption) * Potentially uninit variable used in condition
This commit is contained in:
@ -678,7 +678,7 @@ static uint16_t append_fqdn_dots(uint8_t *packet, uint16_t *index, const char *n
|
|||||||
char *end = host;
|
char *end = host;
|
||||||
char *start = host;
|
char *start = host;
|
||||||
do {
|
do {
|
||||||
end = memchr(start, '.', len);
|
end = memchr(start, '.', host + len - start);
|
||||||
end = end ? end : host + len;
|
end = end ? end : host + len;
|
||||||
int part_len = end - start;
|
int part_len = end - start;
|
||||||
if (!append_single_str(packet, index, start, part_len)) {
|
if (!append_single_str(packet, index, start, part_len)) {
|
||||||
@ -733,6 +733,7 @@ search_next:
|
|||||||
//read the destination into name and compare
|
//read the destination into name and compare
|
||||||
name.parts = 0;
|
name.parts = 0;
|
||||||
name.sub = 0;
|
name.sub = 0;
|
||||||
|
name.invalid = false;
|
||||||
name.host[0] = 0;
|
name.host[0] = 0;
|
||||||
name.service[0] = 0;
|
name.service[0] = 0;
|
||||||
name.proto[0] = 0;
|
name.proto[0] = 0;
|
||||||
|
Reference in New Issue
Block a user