XQuartz: Check for allocated memory before using it in AppleWMSetWindowMenu
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
This commit is contained in:
parent
64327226dd
commit
3bc608a361
|
@ -378,6 +378,13 @@ ProcAppleWMSetWindowMenu(register ClientPtr client)
|
||||||
items = malloc(sizeof(char *) * nitems);
|
items = malloc(sizeof(char *) * nitems);
|
||||||
shortcuts = 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);
|
max_len = (stuff->length << 2) - sizeof(xAppleWMSetWindowMenuReq);
|
||||||
bytes = (char *)&stuff[1];
|
bytes = (char *)&stuff[1];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue