From 3cc85fe74ae62c7d34ccdecf0a1a32ea55d65df8 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 15 Jun 2014 10:33:34 +0200 Subject: [PATCH] Eliminate strcpy() from bsmtp --- bacula/src/tools/bsmtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- 2.39.5