From: Pierre Ossman Date: Mon, 1 Jul 2013 12:46:45 +0000 (+0000) Subject: Fix bad size calculation in GetQueryConnect handler as well X-Git-Tag: v1.3.90~94 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=749eaa7c689e87492dd1e8991d45c0738c97ac18;p=tigervnc.git Fix bad size calculation in GetQueryConnect handler as well as an endian conversion fix. Patch by Christian Steinle. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5124 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc index 7fad77d0..7148486d 100644 --- a/unix/xserver/hw/vnc/vncExtInit.cc +++ b/unix/xserver/hw/vnc/vncExtInit.cc @@ -1025,21 +1025,23 @@ static int ProcVncExtGetQueryConnect(ClientPtr client) rep.addrLen = qcTimeout ? strlen(qcAddress) : 0; rep.userLen = qcTimeout ? strlen(qcUsername) : 0; rep.opaqueId = (CARD32)(long)queryConnectId; - rep.length = (rep.userLen + rep.addrLen + 3) >> 2; + rep.length = ((rep.userLen + 3) >> 2) + ((rep.addrLen + 3) >> 2); if (client->swapped) { #if XORG < 112 int n; swaps(&rep.sequenceNumber, n); - swapl(&rep.userLen, n); swapl(&rep.addrLen, n); + swapl(&rep.userLen, n); swapl(&rep.timeout, n); swapl(&rep.opaqueId, n); + swapl(&rep.length, n); #else swaps(&rep.sequenceNumber); - swapl(&rep.userLen); swapl(&rep.addrLen); + swapl(&rep.userLen); swapl(&rep.timeout); swapl(&rep.opaqueId); + swapl(&rep.length); #endif } WriteToClient(client, sizeof(xVncExtGetQueryConnectReply), (char *)&rep);