net/Resolver: use std::copy()

This commit is contained in:
Max Kellermann 2022-05-31 13:35:09 +02:00
parent 242ba727b2
commit b5a9d0654e
1 changed files with 1 additions and 2 deletions

View File

@ -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