forked from espressif/esp-protocols
fix(mdns): Fix _mdns_append_fqdn excessive stack usage
Move "mdns_name_t name" declaration inside loop to move it out of scope and reclain stack space before recursion call.
This commit is contained in:
@ -751,12 +751,12 @@ static uint16_t _mdns_append_fqdn(uint8_t *packet, uint16_t *index, const char *
|
|||||||
//empty string so terminate
|
//empty string so terminate
|
||||||
return _mdns_append_u8(packet, index, 0);
|
return _mdns_append_u8(packet, index, 0);
|
||||||
}
|
}
|
||||||
mdns_name_t name;
|
|
||||||
static char buf[MDNS_NAME_BUF_LEN];
|
static char buf[MDNS_NAME_BUF_LEN];
|
||||||
uint8_t len = strlen(strings[0]);
|
uint8_t len = strlen(strings[0]);
|
||||||
//try to find first the string length in the packet (if it exists)
|
//try to find first the string length in the packet (if it exists)
|
||||||
uint8_t *len_location = (uint8_t *)memchr(packet, (char)len, *index);
|
uint8_t *len_location = (uint8_t *)memchr(packet, (char)len, *index);
|
||||||
while (len_location) {
|
while (len_location) {
|
||||||
|
mdns_name_t name;
|
||||||
//check if the string after len_location is the string that we are looking for
|
//check if the string after len_location is the string that we are looking for
|
||||||
if (memcmp(len_location + 1, strings[0], len)) { //not continuing with our string
|
if (memcmp(len_location + 1, strings[0], len)) { //not continuing with our string
|
||||||
search_next:
|
search_next:
|
||||||
|
Reference in New Issue
Block a user