From b05ae93e4be12439e54bd2a91f10480b418f4797 Mon Sep 17 00:00:00 2001 From: Teufelchen1 Date: Tue, 9 Apr 2024 11:44:54 +0200 Subject: [PATCH] net/gcoap: Fix typo, replacing _uri with _proxy --- sys/net/application_layer/gcoap/dns.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/net/application_layer/gcoap/dns.c b/sys/net/application_layer/gcoap/dns.c index 1b0ce80d2c..600acf4feb 100644 --- a/sys/net/application_layer/gcoap/dns.c +++ b/sys/net/application_layer/gcoap/dns.c @@ -30,6 +30,7 @@ #include "net/sock/udp.h" #include "net/sock/util.h" #include "random.h" +#include "string_utils.h" #include "uri_parser.h" #include "ut_process.h" @@ -316,14 +317,10 @@ ssize_t gcoap_dns_server_proxy_get(char *proxy, size_t proxy_len) ssize_t res = 0; mutex_lock(&_client_mutex); if (_dns_server_uri_isset()) { - res = strlen(_uri); - if (((size_t)res + 1) > proxy_len) { - /* account for trailing \0 */ + res = strscpy(proxy, _proxy, proxy_len); + if (res == -E2BIG) { res = -ENOBUFS; } - else { - strcpy(proxy, _proxy); - } } mutex_unlock(&_client_mutex); return res;