diff options
author | Carlos Santos <casantos@redhat.com> | 2025-06-01 22:46:42 -0300 |
---|---|---|
committer | Carlos Santos <casantos@redhat.com> | 2025-06-01 23:13:43 -0300 |
commit | 5bfcb7a0c7559c3f029da68d89619e8944021fa8 (patch) | |
tree | e1dc80a49b7f6ffc4400dc77c64219afde657829 | |
parent | 049e15d3d6129e00d2b027f6ad68f0966b893cc0 (diff) | |
download | tigervnc-master.tar.gz tigervnc-master.zip |
Test if the "parts" vector is not empty in TcpFilter::parsePattern()
before attempting to access its first element.
Fixes: https://github.com/TigerVNC/tigervnc/issues/1958
Signed-off-by: Carlos Santos <casantos@redhat.com>
-rw-r--r-- | common/network/TcpSocket.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx index e941aa67..bf3a224c 100644 --- a/common/network/TcpSocket.cxx +++ b/common/network/TcpSocket.cxx @@ -698,7 +698,7 @@ TcpFilter::Pattern TcpFilter::parsePattern(const char* p) { if (parts.size() > 2) throw std::invalid_argument("Invalid filter specified"); - if (parts[0].empty()) { + if (parts.empty() || parts[0].empty()) { // Match any address memset (&pattern.address, 0, sizeof (pattern.address)); pattern.address.u.sa.sa_family = AF_UNSPEC; |