summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorU. Artie Eoff <ullysses.a.eoff@intel.com>2014-05-06 14:50:03 -0700
committerKristian Høgsberg <krh@bitplanet.net>2014-05-06 15:41:02 -0700
commitd8d4701864e8a0e5a1c97e12478d485e814d9941 (patch)
treeb50e372d892955bc417633af396f9a409880b607
parent67072d03d3d4eda1618fd5a97b823585cc7e6fbe (diff)
compositor-wayland: avoid possible NULL deref in handle_keymap
If data is NULL, then we jumped to error which attempts to dereference data. Instead, just close(fd) and return when data is NULL. Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
-rw-r--r--src/compositor-wayland.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 3cd308f4..a08b71ab 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -1424,8 +1424,10 @@ input_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format,
struct xkb_keymap *keymap;
char *map_str;
- if (!data)
- goto error;
+ if (!data) {
+ close(fd);
+ return;
+ }
if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);