aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2020-03-26 08:50:04 +0100
committerPierre Ossman <ossman@cendio.se>2020-03-26 08:50:04 +0100
commitb0875cadc20e36c19490c5d8effd64c30e2d901b (patch)
tree8d6abe95601fa17b082985ce4fd6ade137cdf916 /common
parent8b4be5fd8ea36b0d0d7957a1194b1813e89c7e5a (diff)
downloadtigervnc-b0875cadc20e36c19490c5d8effd64c30e2d901b.tar.gz
tigervnc-b0875cadc20e36c19490c5d8effd64c30e2d901b.zip
Avoid using insecure variable length arrays
Diffstat (limited to 'common')
-rw-r--r--common/rdr/Exception.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/rdr/Exception.cxx b/common/rdr/Exception.cxx
index 9b6096b6..f4e23836 100644
--- a/common/rdr/Exception.cxx
+++ b/common/rdr/Exception.cxx
@@ -57,10 +57,11 @@ GAIException::GAIException(const char* s, int err)
{
strncat(str_, ": ", len-1-strlen(str_));
#ifdef _WIN32
- wchar_t currStr[len-strlen(str_)];
+ wchar_t *currStr = new wchar_t[len-strlen(str_)];
wcsncpy(currStr, gai_strerrorW(err), len-1-strlen(str_));
WideCharToMultiByte(CP_UTF8, 0, currStr, -1, str_+strlen(str_),
len-1-strlen(str_), 0, 0);
+ delete [] currStr;
#else
//FIXME: perhaps print the error number (NNNN)
strncat(str_, gai_strerror(err), len-1-strlen(str_));