]> source.dussan.org Git - tigervnc.git/commitdiff
Remove bogus strncpy() calls
authorPierre Ossman <ossman@cendio.se>
Mon, 7 Dec 2020 11:28:07 +0000 (12:28 +0100)
committerPierre Ossman <ossman@cendio.se>
Mon, 7 Dec 2020 11:28:07 +0000 (12:28 +0100)
We don't know the size of the output buffer here and giving the input
string size is just confusing and upsets the compiler in some cases.

vncviewer/vncviewer.cxx

index b3371c4cb9b08cf67141a8f387a6ebcdef5281a7..68a3747791d1f7279964245bc72521b9bfdddeab 100644 (file)
@@ -454,11 +454,9 @@ interpretViaParam(char *remoteHost, int *remotePort, int localPort)
   }
 
   if (*vncServerName != '\0')
-    strncpy(remoteHost, vncServerName, VNCSERVERNAMELEN);
+    strcpy(remoteHost, vncServerName);
   else
-    strncpy(remoteHost, "localhost", VNCSERVERNAMELEN);
-
-  remoteHost[VNCSERVERNAMELEN - 1] = '\0';
+    strcpy(remoteHost, "localhost");
 
   snprintf(vncServerName, VNCSERVERNAMELEN, "localhost::%d", localPort);
   vncServerName[VNCSERVERNAMELEN - 1] = '\0';