dtdocbook: Coverity 86683
authorPeter Howkins <flibble@users.sf.net>
Wed, 4 Jul 2018 01:18:20 +0000 (02:18 +0100)
committerPeter Howkins <flibble@users.sf.net>
Wed, 4 Jul 2018 01:18:20 +0000 (02:18 +0100)
cde/programs/dtdocbook/tcl/tclUnixSock.c

index 59cb4124ad1ce236214263d6c4ea61d19aeddcec..606f1ca8686961636ce21098f50a7c4f41cac9fd 100644 (file)
@@ -77,9 +77,9 @@ Tcl_GetHostName(void)
     if (uname(&u) > -1) {
         hp = gethostbyname(u.nodename);
         if (hp != NULL) {
-            strcpy(hostname, hp->h_name);
+            snprintf(hostname, sizeof(hostname), "%s", hp->h_name);
         } else {
-            strcpy(hostname, u.nodename);
+            snprintf(hostname, sizeof(hostname), "%s", u.nodename);
         }
         hostnameInited = 1;
         return hostname;