From b2b265a18305f5675f803b6c83f625181bf8e27c Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 7 Dec 2020 12:28:07 +0100 Subject: [PATCH] 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. --- vncviewer/vncviewer.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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'; -- 2.39.5