mirror of
https://github.com/danbulant/node-x11
synced 2026-05-27 05:52:02 +00:00
fix for incorrect length of authType & authData strings in handshake
This commit is contained in:
parent
956ba1e241
commit
d24332c90f
2 changed files with 4 additions and 6 deletions
|
|
@ -183,13 +183,11 @@ bl.unpack('C', function(res) {
|
||||||
function writeClientHello(stream, displayNum, authHost)
|
function writeClientHello(stream, displayNum, authHost)
|
||||||
{
|
{
|
||||||
getAuthString( displayNum, authHost, function( authType, authData ) {
|
getAuthString( displayNum, authHost, function( authType, authData ) {
|
||||||
authType = xutil.padded_string( authType );
|
|
||||||
authData = xutil.padded_string( authData );
|
|
||||||
var byte_order = 'l'.charCodeAt(0); // TODO: byteorder!!!
|
var byte_order = 'l'.charCodeAt(0); // TODO: byteorder!!!
|
||||||
var protocol_major = 11; // TODO: config? env?
|
var protocol_major = 11; // TODO: config? env?
|
||||||
var protocol_minor = 0;
|
var protocol_minor = 0;
|
||||||
stream.pack(
|
stream.pack(
|
||||||
'CxSSSSxxaa',
|
'CxSSSSxxpp',
|
||||||
[
|
[
|
||||||
byte_order,
|
byte_order,
|
||||||
protocol_major,
|
protocol_major,
|
||||||
|
|
|
||||||
|
|
@ -273,11 +273,11 @@ UnpackStream.prototype.pack = function(format, args)
|
||||||
break;
|
break;
|
||||||
case 'p': // padded string
|
case 'p': // padded string
|
||||||
var str = args[arg++];
|
var str = args[arg++];
|
||||||
var len = padded(str);
|
var len = xutil.padded_length(str.length);
|
||||||
// TODO: buffer.write could be faster
|
// TODO: buffer.write could be faster
|
||||||
var c = 0;
|
var c = 0;
|
||||||
for (; c < str.length; ++c)
|
for (; c < str.length; ++c)
|
||||||
buf[offset++] = str[c];
|
buf[offset++] = str.charCodeAt(c);
|
||||||
for (; c < len; ++c)
|
for (; c < len; ++c)
|
||||||
buf[offset++] = 0;
|
buf[offset++] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue