From 77df653ae3d8448be21221711851acde12c6bc1a Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Wed, 1 Jan 2014 11:10:41 -0800 Subject: XQuartz: Avoid passing uninitialized pointers to X11ApplicationSetWindowMenu in AppleWMSetWindowMenu Signed-off-by: Jeremy Huddleston Sequoia --- hw/xquartz/applewm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c index 9ff0ff650..cc91c9608 100644 --- a/hw/xquartz/applewm.c +++ b/hw/xquartz/applewm.c @@ -398,6 +398,15 @@ ProcAppleWMSetWindowMenu(register ClientPtr client) break; } } + + /* Check if we bailed out of the above loop due to a request that was too long */ + if (j < nitems) { + free(items); + free(shortcuts); + + return BadRequest; + } + X11ApplicationSetWindowMenu(nitems, items, shortcuts); free(items); free(shortcuts); -- cgit v1.2.3