mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-14 05:14:45 +00:00
Xi: zero feedback reply buffer in ProcXGetFeedbackControl
The reply payload was allocated with the non-zeroing x_rpcbuf_reserve(), and
the CopySwapKbdFeedback/CopySwapPtrFeedback/CopySwapBellFeedback helpers
populate every field except the internal pad bytes of xKbdFeedbackState (1),
xPtrFeedbackState (2) and xBellFeedbackState (3). Those pad bytes were sent to
the client verbatim, disclosing uninitialized heap memory.
Use x_rpcbuf_reserve0() to zero the buffer, restoring the behaviour that the
earlier calloc()-based code provided before the x_rpcbuf conversion.
Fixes: 6413bd61d7 ("Xi: ProcXGetFeedbackControl(): use x_rpcbuf_t")
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
84b71ab09f
commit
a1fbf5eb0c
1 changed files with 4 additions and 1 deletions
|
|
@ -297,7 +297,10 @@ ProcXGetFeedbackControl(ClientPtr client)
|
|||
return BadMatch;
|
||||
|
||||
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
|
||||
char *buf = x_rpcbuf_reserve(&rpcbuf, total_length);
|
||||
/* Use the zeroing variant: the CopySwap* helpers below do not write the
|
||||
* internal pad bytes of the feedback state structs, which would otherwise
|
||||
* leak uninitialized heap memory to the client. */
|
||||
char *buf = x_rpcbuf_reserve0(&rpcbuf, total_length);
|
||||
|
||||
for (k = dev->kbdfeed; k; k = k->next)
|
||||
CopySwapKbdFeedback(client, k, &buf);
|
||||
|
|
|
|||
Loading…
Reference in a new issue