diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-03-28 21:34:13 +0000 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-03-28 21:34:13 +0000 |
commit | 640609317e6e3d08aa1ac9543b7504839c40751b (patch) | |
tree | 000d820d3b8ec584a345b34fd97b0c0df263eda6 /user/tigervnc/null-termination.patch | |
parent | 7ecd99f5c933f43494c286183748a303003a9a68 (diff) | |
download | packages-640609317e6e3d08aa1ac9543b7504839c40751b.tar.gz packages-640609317e6e3d08aa1ac9543b7504839c40751b.tar.bz2 packages-640609317e6e3d08aa1ac9543b7504839c40751b.tar.xz packages-640609317e6e3d08aa1ac9543b7504839c40751b.zip |
user/tigervnc: Fix build on Intel platforms, use new \0 patch
Diffstat (limited to 'user/tigervnc/null-termination.patch')
-rw-r--r-- | user/tigervnc/null-termination.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/user/tigervnc/null-termination.patch b/user/tigervnc/null-termination.patch new file mode 100644 index 000000000..e80a4f62d --- /dev/null +++ b/user/tigervnc/null-termination.patch @@ -0,0 +1,39 @@ +From 7240f62ddc06643f982456c05c11d8afe5422069 Mon Sep 17 00:00:00 2001 +From: Pierre Ossman <ossman@cendio.se> +Date: Tue, 26 Mar 2019 11:11:20 +0100 +Subject: [PATCH] Handle server name overflow properly + +We need to make sure it is null terminated on truncation. We also +need to avoid giving a too large size argument or modern gcc will +complain. +--- + vncviewer/vncviewer.cxx | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx +index d7cbd6e36..4a8370b95 100644 +--- a/vncviewer/vncviewer.cxx ++++ b/vncviewer/vncviewer.cxx +@@ -411,7 +411,8 @@ potentiallyLoadConfigurationFile(char *vncServerName) + newServerName = loadViewerParameters(vncServerName); + // This might be empty, but we still need to clear it so we + // don't try to connect to the filename +- strncpy(vncServerName, newServerName, VNCSERVERNAMELEN); ++ strncpy(vncServerName, newServerName, VNCSERVERNAMELEN-1); ++ vncServerName[VNCSERVERNAMELEN-1] = '\0'; + } catch (rfb::Exception& e) { + vlog.error("%s", e.str()); + if (alertOnFatalError) +@@ -541,8 +542,10 @@ int main(int argc, char** argv) + try { + const char* configServerName; + configServerName = loadViewerParameters(NULL); +- if (configServerName != NULL) +- strncpy(defaultServerName, configServerName, VNCSERVERNAMELEN); ++ if (configServerName != NULL) { ++ strncpy(defaultServerName, configServerName, VNCSERVERNAMELEN-1); ++ defaultServerName[VNCSERVERNAMELEN-1] = '\0'; ++ } + } catch (rfb::Exception& e) { + vlog.error("%s", e.str()); + if (alertOnFatalError) |