diff options
author | Pierre Ossman <ossman@cendio.se> | 2012-07-19 11:06:27 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2012-07-19 11:06:27 +0000 |
commit | 229229648fa3c2e035306d1845a20c9240b1a383 (patch) | |
tree | 8f2b7373156312881dee988acc44fa5158a6bbec /common/rfb/Decoder.cxx | |
parent | e211518b65cf72a5be0b9bb9a71fa715196bed19 (diff) | |
download | tigervnc-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.cxx | 4 |
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; } |