From: Kern Sibbald Date: Sun, 15 Jun 2014 08:33:34 +0000 (+0200) Subject: Eliminate strcpy() from bsmtp X-Git-Tag: Release-7.0.5~39 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3cc85fe74ae62c7d34ccdecf0a1a32ea55d65df8;p=bacula%2Fbacula Eliminate strcpy() from bsmtp --- diff --git a/bacula/src/tools/bsmtp.c b/bacula/src/tools/bsmtp.c index a3e5eef541..8e6d4f53a7 100644 --- a/bacula/src/tools/bsmtp.c +++ b/bacula/src/tools/bsmtp.c @@ -400,7 +400,7 @@ int main (int argc, char *argv[]) my_hostname, gai_strerror(res)); exit(1); } - strcpy(my_hostname, ai->ai_canonname); + bstrncpy(my_hostname, ai->ai_canonname, sizeof(my_hostname)); freeaddrinfo(ai); #else if ((hp = gethostbyname(my_hostname)) == NULL) { @@ -408,7 +408,7 @@ int main (int argc, char *argv[]) my_hostname, strerror(errno)); exit(1); } - strcpy(my_hostname, hp->h_name); + bstrncpy(my_hostname, hp->h_name, sizeof(my_hostname)); #endif Dmsg1(20, "My hostname is: %s\n", my_hostname);