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>
This commit is contained in:
parent
67072d03d3
commit
d8d4701864
@ -1424,8 +1424,10 @@ input_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format,
|
|||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
char *map_str;
|
char *map_str;
|
||||||
|
|
||||||
if (!data)
|
if (!data) {
|
||||||
goto error;
|
close(fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
|
if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
|
||||||
map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
|
map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user