Commit 5440aaa5222b02275b4fd982f5326c92c072982b

Daniel Stone 2017-06-26T21:52:27

Fix signed vs. unsigned confusion in name sanitisation Don't try to divide through a signed char when indexing an array, lest ye try to index off the start of it. Signed-off-by: Daniel Stone <daniels@collabora.com>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/keymap-priv.c b/src/keymap-priv.c
index 08945ca..fffb2fd 100644
--- a/src/keymap-priv.c
+++ b/src/keymap-priv.c
@@ -118,7 +118,8 @@ XkbEscapeMapName(char *name)
         return;
 
     while (*name) {
-        if (!(legal[*name / 8] & (1 << (*name % 8))))
+        unsigned char c = *name;
+        if (!(legal[c / 8] & (1 << (c % 8))))
             *name = '_';
         name++;
     }