From: Pierre Ossman Date: Mon, 7 Dec 2020 11:28:07 +0000 (+0100) Subject: Remove bogus strncpy() calls X-Git-Tag: v1.11.90~85 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b2b265a18305f5675f803b6c83f625181bf8e27c;p=tigervnc.git Remove bogus strncpy() calls 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. --- diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index b3371c4c..68a37477 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -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';