summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2013-05-02 20:03:15 +0200
committerAlexander Preisinger <alexander.preisinger@gmail.com>2013-05-02 21:01:19 +0200
commitc0b8c35e3ba858ef8e5e47ebc45ccaa88ef86348 (patch)
treeee7ec6fedced3e6c052d2710e33bdb8ef721b732 /video
parent0d1cd116d7d17e2a61c2d7d93184dde7c655c947 (diff)
downloadmpv-c0b8c35e3ba858ef8e5e47ebc45ccaa88ef86348.tar.bz2
mpv-c0b8c35e3ba858ef8e5e47ebc45ccaa88ef86348.tar.xz
wayland: use new function xkb_keymap_from_buffer
Bump xkbcommon version and use the new xkb_keymap_from_buffer. This is more secure, because the from_string expects a 0 terminated string, but this cannot be guaranteed with mmap.
Diffstat (limited to 'video')
-rw-r--r--video/out/wayland_common.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 8c8033f87a..0bcd9395be 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -217,15 +217,10 @@ static void keyboard_handle_keymap(void *data,
int32_t fd,
uint32_t size)
{
- struct vo_wayland_input *input = ((struct vo_wayland_state *) data)->input;
+ struct vo_wayland_input *input;
char *map_str;
- if(!data) {
- close(fd);
- return;
- }
-
- if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
+ if(!data || format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
close(fd);
return;
}
@@ -236,8 +231,9 @@ static void keyboard_handle_keymap(void *data,
return;
}
- input->xkb.keymap = xkb_map_new_from_string(input->xkb.context,
- map_str, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
+ input = ((struct vo_wayland_state *) data)->input;
+ input->xkb.keymap = xkb_keymap_new_from_buffer(input->xkb.context,
+ map_str, size, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
munmap(map_str, size);
close(fd);