mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-27 12:35:26 +00:00
mdns: Use strlen to determine string length of strings contained in a struct - padding seems to be applied to these strings, and sizeof() returns the _padded_ size???
Found by compiling with CLANG with address sanitizer enabled
This commit is contained in:
parent
ee7a2f346c
commit
ad17f345e7
@ -570,7 +570,7 @@ mdns_build_dnssd_domain(struct mdns_domain *domain)
|
||||
LWIP_ERROR("mdns_build_dnssd_domain: Failed to add label", (res == ERR_OK), return res);
|
||||
res = mdns_domain_add_label(domain, "_dns-sd", (u8_t)(sizeof("_dns-sd")-1));
|
||||
LWIP_ERROR("mdns_build_dnssd_domain: Failed to add label", (res == ERR_OK), return res);
|
||||
res = mdns_domain_add_label(domain, dnssd_protos[DNSSD_PROTO_UDP], (u8_t)(sizeof(dnssd_protos[DNSSD_PROTO_UDP])-1));
|
||||
res = mdns_domain_add_label(domain, dnssd_protos[DNSSD_PROTO_UDP], (u8_t)strlen(dnssd_protos[DNSSD_PROTO_UDP]));
|
||||
LWIP_ERROR("mdns_build_dnssd_domain: Failed to add label", (res == ERR_OK), return res);
|
||||
return mdns_add_dotlocal(domain);
|
||||
}
|
||||
@ -595,7 +595,7 @@ mdns_build_service_domain(struct mdns_domain *domain, struct mdns_service *servi
|
||||
}
|
||||
res = mdns_domain_add_label(domain, service->service, (u8_t)strlen(service->service));
|
||||
LWIP_ERROR("mdns_build_service_domain: Failed to add label", (res == ERR_OK), return res);
|
||||
res = mdns_domain_add_label(domain, dnssd_protos[service->proto], (u8_t)(sizeof(dnssd_protos[DNSSD_PROTO_UDP])-1));
|
||||
res = mdns_domain_add_label(domain, dnssd_protos[service->proto], (u8_t)strlen(dnssd_protos[service->proto]));
|
||||
LWIP_ERROR("mdns_build_service_domain: Failed to add label", (res == ERR_OK), return res);
|
||||
return mdns_add_dotlocal(domain);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user