aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/Decoder.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2012-07-19 11:06:27 +0000
committerPierre Ossman <ossman@cendio.se>2012-07-19 11:06:27 +0000
commit229229648fa3c2e035306d1845a20c9240b1a383 (patch)
tree8f2b7373156312881dee988acc44fa5158a6bbec /common/rfb/Decoder.cxx
parente211518b65cf72a5be0b9bb9a71fa715196bed19 (diff)
downloadtigervnc-229229648fa3c2e035306d1845a20c9240b1a383.tar.gz
tigervnc-229229648fa3c2e035306d1845a20c9240b1a383.zip
Also check for negative encodings, in case the server is throwing unexpected
garbage at us. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4942 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/rfb/Decoder.cxx')
-rw-r--r--common/rfb/Decoder.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/rfb/Decoder.cxx b/common/rfb/Decoder.cxx
index 61d8bcee..193b61c0 100644
--- a/common/rfb/Decoder.cxx
+++ b/common/rfb/Decoder.cxx
@@ -34,12 +34,12 @@ DecoderCreateFnType Decoder::createFns[encodingMax+1] = { 0 };
bool Decoder::supported(int encoding)
{
- return encoding <= encodingMax && createFns[encoding];
+ return encoding >= 0 && encoding <= encodingMax && createFns[encoding];
}
Decoder* Decoder::createDecoder(int encoding, CMsgReader* reader)
{
- if (encoding <= encodingMax && createFns[encoding])
+ if (supported(encoding))
return (*createFns[encoding])(reader);
return 0;
}