[client] spice: validate clipboard responses

This commit is contained in:
Geoffrey McRae
2026-07-28 13:08:16 +10:00
parent e73a3dec60
commit e4658b4263
3 changed files with 32 additions and 15 deletions

View File

@@ -563,6 +563,9 @@ static const struct wl_data_source_listener dataSourceListener = {
static void waylandCBReplyFn(void * opaque, LG_ClipboardData type,
uint8_t * data, uint32_t size)
{
if (type == LG_CLIPBOARD_DATA_NONE)
return;
struct WCBTransfer * transfer = malloc(sizeof(*transfer));
if (!transfer)
{

View File

@@ -135,15 +135,18 @@ static void x11CBReplyFn(void * opaque, LG_ClipboardData type,
{
XEvent *s = (XEvent *)opaque;
XChangeProperty(
x11.display ,
s->xselection.requestor,
s->xselection.property ,
s->xselection.target ,
8,
PropModeReplace,
data,
size);
if (type == LG_CLIPBOARD_DATA_NONE)
s->xselection.property = None;
else
XChangeProperty(
x11.display ,
s->xselection.requestor,
s->xselection.property ,
s->xselection.target ,
8,
PropModeReplace,
data,
size);
XSendEvent(x11.display, s->xselection.requestor, 0, 0, s);
XFlush(x11.display);