Added command length guard to desktop multiplexor.

Ylian Saint-Hilaire committed Jul 30, 2021 at 11:18 UTC 6d7289f74a94e4f6585d158d3073bb15f8e2f085
1 file changed +2
meshdesktopmultiplex.js
+2
@@ -471,6 +471,8 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
471 if ((typeof data != 'object') || (data.length < 4)) return; // Ignore all control traffic for now (WebRTC)
472 var command = data.readUInt16BE(0);
473 var cmdsize = data.readUInt16BE(2);
474 + if (data.length != cmdsize) return; // Invalid command length
475 +
476 //console.log('ViewerData', data.length, command, cmdsize);
477 switch (command) {
478 case 1: // Key Events, forward to agent