From 3aa605fe24117dd794cbe3d0e0bd01bba4a729c9 Mon Sep 17 00:00:00 2001 From: Roman Valls Guimera Date: Wed, 25 Oct 2017 23:23:42 +0200 Subject: [PATCH] Fix compilation errors when using gcc-7.2.0 for the crosstool-ng toolchain * Change snprintf for strlcat does not complain w/gcc7.2.0 and it is safer, thanks @projectgus * Use proper quotes for character literals Merges https://github.com/espressif/esp-idf/pull/1163 * Original commit: espressif/esp-idf@519edc332dae0160069fd790467cde8de78f1a0e --- components/mdns/mdns.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/mdns/mdns.c b/components/mdns/mdns.c index c77283e07..171da177c 100644 --- a/components/mdns/mdns.c +++ b/components/mdns/mdns.c @@ -569,7 +569,8 @@ static const uint8_t * _mdns_read_fqdn(const uint8_t * packet, const uint8_t * s && (strcmp(buf, MDNS_DEFAULT_DOMAIN) != 0) && (strcmp(buf, "ip6") != 0) && (strcmp(buf, "in-addr") != 0)) { - snprintf((char*)name, MDNS_NAME_BUF_LEN, "%s.%s", name->host, buf); + strlcat(name->host, ".", sizeof(name->host)); + strlcat(name->host, buf, sizeof(name->host)); } else if (strcmp(buf, MDNS_SUB_STR) == 0) { name->sub = 1; } else {