Skip to content

Commit 9125abc

Browse files
committed
TightVNC 2.8.87
.Server for Windows: Fixed operation in application mode for environments with multiple simultaneous RDP sessions (bug #1647). .Server for Windows: Increased maximum screen size (width or height) from 32,000 to 65,535 pixels. .Server and Viewer for Windows: Fixed bugs in buffer size calculation when receiving and converting clipboard data. .Installer for Windows: The uninstaller now correctly removes the TightVNC Service Control Application.
1 parent b83a68f commit 9125abc

23 files changed

Lines changed: 106 additions & 123 deletions

desktop-ipc/DesktopServerProto.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ void DesktopServerProto::checkPixelFormat(const PixelFormat *pf)
5353
void DesktopServerProto::checkRectangle(const Rect *rect)
5454
{
5555
StringStorage errMess;
56-
if (abs(rect->left) > 32000 ||
57-
abs(rect->top) > 32000 ||
58-
abs(rect->right) > 32000 ||
59-
abs(rect->bottom) > 32000 ||
56+
if (abs(rect->left) > 65535 ||
57+
abs(rect->top) > 65535 ||
58+
abs(rect->right) > 65535 ||
59+
abs(rect->bottom) > 65535 ||
6060
!rect->isValid()) {
6161
errMess.format(_T("Wrong rectangle (%d, %d, %d, %d)"), rect->left,
6262
rect->top,
@@ -69,8 +69,8 @@ void DesktopServerProto::checkRectangle(const Rect *rect)
6969
void DesktopServerProto::checkDimension(const Dimension *dim)
7070
{
7171
StringStorage errMess;
72-
if (abs(dim->width) > 64000 ||
73-
abs(dim->height) > 64000) {
72+
if (abs(dim->width) > 65535 ||
73+
abs(dim->height) > 65535) {
7474
errMess.format(_T("Wrong dimension (%dx%d)"), dim->width,
7575
dim->height);
7676
throw Exception(errMess.getString());

desktop/WindowsClipboard.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#include "WindowsClipboard.h"
2626
#include "tvnserver-app/NamingDefs.h"
27+
#include "util/Exception.h"
28+
#include <vector>
2729

2830
const HINSTANCE WindowsClipboard::m_hinst = GetModuleHandle(0);
2931

@@ -179,7 +181,10 @@ void WindowsClipboard::convertToRfbFormat(const StringStorage *source,
179181
{
180182
const TCHAR *srcText = source->getString();
181183
size_t length = source->getLength();
182-
TCHAR *rfbText = new TCHAR[length + 1];
184+
if (length > SIZE_MAX - 1) {
185+
throw Exception(_T("Integer overflow in clipboard allocation"));
186+
}
187+
std::vector<TCHAR> rfbText(length + 1);
183188

184189
size_t j = 0;
185190
for (size_t i = 0; i < length; i++) {
@@ -189,8 +194,7 @@ void WindowsClipboard::convertToRfbFormat(const StringStorage *source,
189194
}
190195
}
191196
rfbText[j] = 0;
192-
dest->setString(rfbText);
193-
delete[] rfbText;
197+
dest->setString(&rfbText.front());
194198
}
195199

196200
void WindowsClipboard::convertFromRfbFormat(const TCHAR *source,
@@ -204,10 +208,15 @@ void WindowsClipboard::convertFromRfbFormat(const TCHAR *source,
204208
lfCount++;
205209
}
206210
}
207-
211+
if (lfCount > SIZE_MAX - sourceLen) {
212+
throw Exception(_T("Integer overflow in size calculation"));
213+
}
208214
size_t destLen = sourceLen + lfCount;
209-
TCHAR *destText = new TCHAR[destLen + 1];
210-
int j = 0;
215+
if (destLen > SIZE_MAX - 1) {
216+
throw Exception(_T("Integer overflow in clipboard allocation"));
217+
}
218+
std::vector<TCHAR> destText(destLen + 1);
219+
size_t j = 0;
211220
for (size_t i = 0; i < sourceLen; i++) {
212221
if (source[i] == 0x0a) {
213222
destText[j] = 0x0d;
@@ -218,6 +227,5 @@ void WindowsClipboard::convertFromRfbFormat(const TCHAR *source,
218227
}
219228
destText[j] = 0;
220229

221-
dest->setString(destText);
222-
delete[] destText;
230+
dest->setString(&destText.front());
223231
}

hookldr/hookldr.rc

0 Bytes
Binary file not shown.

rfb-sconn/ClipboardExchange.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ void ClipboardExchange::onRequest(UINT32 reqCode, RfbInputGate *input)
8383
}
8484
void ClipboardExchange::onRequestWorker(bool utf8flag, RfbInputGate *input)
8585
{
86-
UINT32 length = input->readUInt32();
86+
size_t length = input->readUInt32();
87+
88+
if (length > SIZE_MAX - 1) {
89+
throw Exception(_T("Integer overflow in clipboard allocation"));
90+
}
8791

8892
std::vector<char> charBuff(length + 1);
8993

screen-hooks/screenhooks.rc

0 Bytes
Binary file not shown.

setup-helper/setup-helper.rc

0 Bytes
Binary file not shown.

tvncontrol-app/ControlPipeName.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ void ControlPipeName::createPipeName(bool forService, StringStorage *pipeName, L
3535
pipeName->setString(
3636
ServerApplicationNames::FOR_SERVICE_CONTROL_APP_PIPE_NAME);
3737
} else {
38-
pipeName->format(_T("%s_On_Session_%d"),
39-
ServerApplicationNames::FOR_APP_CONTROL_APP_SERVICE_PIPE_NAME,
40-
WTS::getActiveConsoleSessionId(log));
38+
try {
39+
pipeName->format(_T("%s_On_Session_%d"),
40+
ServerApplicationNames::FOR_APP_CONTROL_APP_SERVICE_PIPE_NAME,
41+
WTS::getProcessSessionId(log));
42+
} catch (Exception &e) {
43+
log->error(_T("getProcessSessionId failed: %s"), e.getMessage());
44+
}
4145
}
4246
}

tvnserver-app/NamingDefs.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ const TCHAR ProductNames::SERVER_PRODUCT_NAME[] = _T("TightVNC Server");
3333
const TCHAR RegistryPaths::SERVER_PATH[] = _T("Software\\TightVNC\\Server");
3434
const TCHAR RegistryPaths::SERVER_REVERSE_CONN_HISTORY_PATH[] =
3535
_T("Software\\TightVNC\\Control\\ReverseConnectionHistory");
36-
const TCHAR RegistryPaths::DISPATCHER_CONN_HISTORY_PATH[] =
37-
_T("Software\\TightVNC\\Control\\DispatcherConnectionHistory");
3836

3937
const TCHAR WindowNames::WINDOW_CLASS_NAME[] =
4038
_T("TvnWindowsApplicationClass");

tvnserver-app/NamingDefs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class RegistryPaths
4646
public:
4747
static const TCHAR SERVER_PATH[];
4848
static const TCHAR SERVER_REVERSE_CONN_HISTORY_PATH[];
49-
static const TCHAR DISPATCHER_CONN_HISTORY_PATH[];
5049
};
5150

5251
class WindowNames

tvnserver/tvnserver.rc

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)