From: Remi Gacogne Date: Mon, 4 Jun 2018 09:49:50 +0000 (+0200) Subject: Fix a GCC warning about strncpy() X-Git-Tag: dnsdist-1.3.1~45^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb74983967f253a9a2590f41efad9bc6a0e89342;p=pdns Fix a GCC warning about strncpy() We always NULL-terminate the string anyway, but let's make the compiler happy. --- 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)