diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-02 15:42:09 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-02 15:44:04 +0100 |
commit | 0ee287af222552f4968f7d78ebc748db5bed5963 (patch) | |
tree | 2de512bd0c7426582746fdbf84c8d754e4f6417d /tools | |
parent | dd5f17ed3adf0c4e7c642f685f61766d12247c0e (diff) |
intel-virtual-overlay: Prevent buffer overrun reading the XEvent
When calling XNextEvent() you must provide it with space for any event,
i.e. XEvent, and not be tempted to pass in the specific type you are
waiting for!
Reported-by: Philipp Adolf
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/virtual.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/virtual.c b/tools/virtual.c index ffac700b..ccd8c85e 100644 --- a/tools/virtual.c +++ b/tools/virtual.c @@ -1901,13 +1901,13 @@ static int first_display_register_as_singleton(struct context *ctx) } while (XPending(display->dpy)) { - XPropertyEvent pe; + XEvent e; - XNextEvent(display->dpy, (XEvent *)&pe); - DBG(("%s: reading event type %d\n", DisplayString(display->dpy), pe.type)); + XNextEvent(display->dpy, &e); + DBG(("%s: reading event type %d\n", DisplayString(display->dpy), e.type)); - if (pe.type == PropertyNotify && - pe.atom == ctx->singleton) + if (e.type == PropertyNotify && + ((XPropertyEvent *)&e)->atom == ctx->singleton) return 0; } } while (1); |