summaryrefslogtreecommitdiff
path: root/src/xkbcomp/keycodes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xkbcomp/keycodes.c')
-rw-r--r--src/xkbcomp/keycodes.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index f134d85..4273ebe 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -461,7 +461,7 @@ HandleIncludeKeycodes(KeyNamesInfo *info, IncludeStmt *stmt)
return (info->errorCount == 0);
}
-static int
+static bool
HandleKeycodeDef(KeyNamesInfo *info, KeycodeDef *stmt, enum merge_mode merge)
{
if (stmt->merge != MERGE_DEFAULT) {
@@ -471,6 +471,13 @@ HandleKeycodeDef(KeyNamesInfo *info, KeycodeDef *stmt, enum merge_mode merge)
merge = stmt->merge;
}
+ if (stmt->value < 0 || stmt->value > XKB_KEYCODE_MAX) {
+ log_err(info->ctx,
+ "Illegal keycode %lld: must be between 0..%u; "
+ "Key ignored\n", stmt->value, XKB_KEYCODE_MAX);
+ return false;
+ }
+
return AddKeyName(info, stmt->value, stmt->name, merge,
info->file_id, true);
}