diff options
author | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2014-01-01 11:04:07 -0800 |
---|---|---|
committer | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2014-01-22 15:17:41 -0800 |
commit | 859ced56d9ee168796c2fcf7fa6056e0c1491f3a (patch) | |
tree | 7efde637352edc16dcb3ef68634eebc0981c8a3b | |
parent | 9444955d16f85926c75ee8eafb0ca796dcf16439 (diff) |
XQuartz: Check for allocated memory before using it in AppleWMSetWindowMenu
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 3bc608a361a01043b226fb9aaebf88f6fd852925)
-rw-r--r-- | hw/xquartz/applewm.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c index aea0a45f2..c4e5f4a71 100644 --- a/hw/xquartz/applewm.c +++ b/hw/xquartz/applewm.c @@ -378,6 +378,13 @@ ProcAppleWMSetWindowMenu(register ClientPtr client) items = malloc(sizeof(char *) * nitems); shortcuts = malloc(sizeof(char) * nitems); + if (!items || !shortcuts) { + free(items); + free(shortcuts); + + return BadAlloc; + } + max_len = (stuff->length << 2) - sizeof(xAppleWMSetWindowMenuReq); bytes = (char *)&stuff[1]; |