From 6b7a69e80759cc05a7a399aa5967437f3e0c6bd1 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 28 Feb 2023 16:00:15 +0100 Subject: [PATCH] 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. --- common/rfb/SConnection.cxx | 4 ++-- 1 file 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 #include -#include #include #include #include @@ -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; } -- 2.39.5