summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/keymap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/keymap.c b/src/keymap.c
index d2baf94..0291aed 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -194,6 +194,10 @@ xkb_keymap_new_from_buffer(struct xkb_context *ctx,
if (!keymap)
return NULL;
+ /* Allow a zero-terminated string as a buffer */
+ if (length > 0 && buffer[length - 1] == '\0')
+ length--;
+
if (!ops->keymap_new_from_string(keymap, buffer, length)) {
xkb_keymap_unref(keymap);
return NULL;