From b5a9d0654ee212780e0fc1a37b2bb678dd8c431a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 31 May 2022 13:35:09 +0200 Subject: [PATCH] net/Resolver: use std::copy() --- src/net/Resolver.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/net/Resolver.cxx b/src/net/Resolver.cxx index 19da604e0..be23cf1f4 100644 --- a/src/net/Resolver.cxx +++ b/src/net/Resolver.cxx @@ -111,8 +111,7 @@ Resolve(const char *host_and_port, int default_port, if (eh.host.size() >= sizeof(buffer)) throw std::runtime_error("Host name too long"); - memcpy(buffer, eh.host.data(), eh.host.size()); - buffer[eh.host.size()] = 0; + *std::copy(eh.host.begin(), eh.host.end(), buffer) = 0; host = buffer; #ifndef _WIN32