From bb74983967f253a9a2590f41efad9bc6a0e89342 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 4 Jun 2018 11:49:50 +0200 Subject: [PATCH] Fix a GCC warning about strncpy() We always NULL-terminate the string anyway, but let's make the compiler happy. --- pdns/rec_channel.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdns/rec_channel.cc b/pdns/rec_channel.cc index 3c0fb6d87..2bbb54c1a 100644 --- a/pdns/rec_channel.cc +++ b/pdns/rec_channel.cc @@ -115,7 +115,7 @@ void RecursorControlChannel::send(const std::string& msg, const std::string* rem memset(&remoteaddr, 0, sizeof(remoteaddr)); remoteaddr.sun_family=AF_UNIX; - strncpy(remoteaddr.sun_path, remote->c_str(), sizeof(remoteaddr.sun_path)); + strncpy(remoteaddr.sun_path, remote->c_str(), sizeof(remoteaddr.sun_path)-1); remoteaddr.sun_path[sizeof(remoteaddr.sun_path)-1] = '\0'; if(::sendto(d_fd, msg.c_str(), msg.length(), 0, (struct sockaddr*) &remoteaddr, sizeof(remoteaddr) ) < 0) -- 2.40.0