summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-02-17 23:14:43 +0000
committeryexo <yexo@openttd.org>2011-02-17 23:14:43 +0000
commit24753fbd35045d23f079dbc80e40a0098dbbf6e5 (patch)
tree04b20d6500780b3a8133f87b4ce2ba6d2c978e56 /src
parent1a5087be694a691bfc93390f18d751dc1ad0dea5 (diff)
downloadopenttd-24753fbd35045d23f079dbc80e40a0098dbbf6e5.tar.xz
(svn r22094) -Fix [FS#4510]: remove invalid keycodes when reading hotkeys.cfg
Diffstat (limited to 'src')
-rw-r--r--src/hotkeys.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/hotkeys.cpp b/src/hotkeys.cpp
index 8619bd694..686877bf3 100644
--- a/src/hotkeys.cpp
+++ b/src/hotkeys.cpp
@@ -95,8 +95,14 @@ static uint16 ParseKeycode(const char *start, const char *end)
uint16 code = ParseCode(start, cur);
if (code == 0) return 0;
if (code & WKC_SPECIAL_KEYS) {
+ /* Some completely wrong keycode we don't support. */
+ if (code & ~WKC_SPECIAL_KEYS) return 0;
keycode |= code;
} else {
+ /* Ignore invalid keycodes */
+ if (code >= 128) {
+ return 0;
+ }
/* Ignore the code if it has more then 1 letter. */
if (keycode & ~WKC_SPECIAL_KEYS) return 0;
keycode |= code;