aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2023-02-28 16:00:15 +0100
committerPierre Ossman <ossman@cendio.se>2023-02-28 16:00:15 +0100
commit6b7a69e80759cc05a7a399aa5967437f3e0c6bd1 (patch)
treef2087a7eafb5b867eb34ebf53cedb202daaa87e9 /common/rfb
parent75e6e8e35c70f186f785c326cb3060bff214d627 (diff)
downloadtigervnc-6b7a69e80759cc05a7a399aa5967437f3e0c6bd1.tar.gz
tigervnc-6b7a69e80759cc05a7a399aa5967437f3e0c6bd1.zip
Throw exception instead on bad access check
An assert will kill the entire server, which is overly harsh when there is a problem with a single connection. Instead, throw an exception which will just disconnect that specific client.
Diffstat (limited to 'common/rfb')
-rw-r--r--common/rfb/SConnection.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx
index 8e0bff8c..0bb8e4a9 100644
--- a/common/rfb/SConnection.cxx
+++ b/common/rfb/SConnection.cxx
@@ -23,7 +23,6 @@
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <rfb/Exception.h>
#include <rfb/Security.h>
#include <rfb/clipboardTypes.h>
@@ -347,7 +346,8 @@ void SConnection::setAccessRights(AccessRights ar)
bool SConnection::accessCheck(AccessRights ar) const
{
- assert(state_ >= RFBSTATE_QUERYING);
+ if (state_ < RFBSTATE_QUERYING)
+ throw Exception("SConnection::accessCheck: invalid state");
return (accessRights & ar) == ar;
}