diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-05-30 23:38:48 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-05-31 07:58:31 +0300 |
commit | 6dfe238ff1e756bc51a609143d22f0659e3e89c8 (patch) | |
tree | 8406efc7424eef1bf82a8c5bd3a6d6cddbc85165 | |
parent | a5e32f652b84ae71e207af6b9615a69c7738928f (diff) |
zwp_virtual-keyboard: fix mmap error handling
If mmap fails, it will return MAP_FAILED not NULL. Since the error
handling was incorrectly checking for NULL, MAP_FAILED was being passed
to xkb_keymap_new_from_string, on mmap failure, causing a segfault.
This just fixes the error checking.
-rw-r--r-- | types/wlr_virtual_keyboard_v1.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/types/wlr_virtual_keyboard_v1.c b/types/wlr_virtual_keyboard_v1.c index e5463295..ffbd8a4e 100644 --- a/types/wlr_virtual_keyboard_v1.c +++ b/types/wlr_virtual_keyboard_v1.c @@ -51,7 +51,7 @@ static void virtual_keyboard_keymap(struct wl_client *client, goto context_fail; } void *data = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); - if (!data) { + if (data == MAP_FAILED) { goto fd_fail; } struct xkb_keymap *keymap = xkb_keymap_new_from_string(context, data, |