From 9260a443a175731994fb8642365cd3969b605cfe Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Thu, 11 Nov 2010 13:18:02 +0000 Subject: [PATCH] [Bugfix] Xvnc: use strncpy instead of strncat to copy string to uninitialized destination. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4190 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- unix/xserver/hw/vnc/XserverDesktop.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc index ba7ccf77..5672847d 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.cc +++ b/unix/xserver/hw/vnc/XserverDesktop.cc @@ -255,7 +255,8 @@ char* XserverDesktop::substitute(const char* varName) struct utsname uts; uname(&uts); char* str = new char[256]; - strncat(str, uts.nodename, 240); + strncpy(str, uts.nodename, 240); + str[239] = '\0'; /* Ensure string is zero-terminated */ strcat(str, ":"); strncat(str, display, 10); return str; -- 2.39.5