mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
xkb: ProcXkbGetKbdByName(): extra payload size sanity check
Add extra check for comparing the actually written sub-payload sizes with their previously computed ones. This is meant for troubeshooting while still stabelizing the previous, not entirely trivial commits. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
e1315e22db
commit
84dd2a5039
16
xkb/xkb.c
16
xkb/xkb.c
@@ -5899,6 +5899,10 @@ ProcXkbGetKbdByName(ClientPtr client)
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
if (rpcbuf.wpos != (mrep.length * 4))
|
||||
LogMessage(X_WARNING, "ProcXkbGetKbdByName() childbuf size (%ld) mismatch mrep size (%ld // %d units)\n",
|
||||
(unsigned long)rpcbuf.wpos, (unsigned long)mrep.length * 4, mrep.length);
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&mrep.sequenceNumber);
|
||||
swapl(&mrep.length);
|
||||
@@ -5919,6 +5923,10 @@ ProcXkbGetKbdByName(ClientPtr client)
|
||||
|
||||
XkbAssembleCompatMap(client, new->compat, crep, &rpcbuf);
|
||||
|
||||
if (rpcbuf.wpos != (crep.length * 4))
|
||||
LogMessage(X_WARNING, "ProcXkbGetKbdByName() childbuf size (%ld) mismatch crep size (%ld // %d units)\n",
|
||||
(unsigned long)rpcbuf.wpos, (unsigned long)crep.length * 4, crep.length);
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&crep.sequenceNumber);
|
||||
swapl(&crep.length);
|
||||
@@ -5944,6 +5952,10 @@ ProcXkbGetKbdByName(ClientPtr client)
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
if (rpcbuf.wpos != (irep.length * 4))
|
||||
LogMessage(X_WARNING, "ProcXkbGetKbdByName() childbuf size (%ld) mismatch irep size (%ld // %d units)\n",
|
||||
(unsigned long)rpcbuf.wpos, (unsigned long)irep.length * 4, irep.length);
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&irep.sequenceNumber);
|
||||
swapl(&irep.length);
|
||||
@@ -5963,6 +5975,10 @@ ProcXkbGetKbdByName(ClientPtr client)
|
||||
|
||||
XkbAssembleNames(client, new, nrep, &rpcbuf);
|
||||
|
||||
if (rpcbuf.wpos != (nrep.length * 4))
|
||||
LogMessage(X_WARNING, "ProcXkbGetKbdByName() childbuf size (%ld) mismatch nrep size (%ld // %d units)\n",
|
||||
(unsigned long)rpcbuf.wpos, (unsigned long)nrep.length * 4, nrep.length);
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&nrep.sequenceNumber);
|
||||
swapl(&nrep.length);
|
||||
|
||||
Reference in New Issue
Block a user