From 85b35fc0cc30b41617eea6d0317da40fc3ea6c97 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 13 Oct 2017 13:57:19 +0200 Subject: [PATCH] Add proper protocol encoder for XVP messages --- core/rfb.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/core/rfb.js b/core/rfb.js index 3565f7cd..18380e7e 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -285,7 +285,7 @@ RFB.prototype = { xvpOp: function (ver, op) { if (this._rfb_xvp_ver < ver) { return false; } Log.Info("Sending XVP operation " + op + " (version " + ver + ")"); - this._sock.send_string("\xFA\x00" + String.fromCharCode(ver) + String.fromCharCode(op)); + RFB.messages.xvpOp(this._sock, ver, op); return true; }, @@ -1850,7 +1850,21 @@ RFB.messages = { sock._sQlen += 10; sock.flush(); - } + }, + + xvpOp: function (sock, ver, op) { + var buff = sock._sQ; + var offset = sock._sQlen; + + buff[offset] = 250; // msg-type + buff[offset + 1] = 0; // padding + + buff[offset + 2] = ver; + buff[offset + 3] = op; + + sock._sQlen += 4; + sock.flush(); + }, }; RFB.genDES = function (password, challenge) {