aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-08-13 20:36:35 +0200
committerMattias Andrée <maandree@operamail.com>2014-08-13 20:36:35 +0200
commite10971920d0492f0f1bb340f0b5b9b1ca82ecc66 (patch)
tree89032a1456b08066498ce8a81ae0e93154cd4135 /src
parentmds-kkbd: announce new keyboard when starting (diff)
downloadmds-e10971920d0492f0f1bb340f0b5b9b1ca82ecc66.tar.gz
mds-e10971920d0492f0f1bb340f0b5b9b1ca82ecc66.tar.bz2
mds-e10971920d0492f0f1bb340f0b5b9b1ca82ecc66.tar.xz
keycodes not be larger than 2¹⁴
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/mds-kkbd.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mds-kkbd.c b/src/mds-kkbd.c
index ef4f756..6919ed0 100644
--- a/src/mds-kkbd.c
+++ b/src/mds-kkbd.c
@@ -976,7 +976,7 @@ static int remap(char* table, size_t n)
int in, out;
parse_remap_line(begin, end, n, &in, &out);
- if ((in < 0) || (out < 0))
+ if ((in < 0) || (out < 0) || ((in | out) >= 0x4000))
{
eprint("received malformated remapping table.");
goto next;
@@ -1023,8 +1023,7 @@ static int mapping_query(const char* recv_client_id, const char* recv_message_id
n++;
}
- n *= 3 + (greatest > 0xFFFF ? (3 * sizeof(int)) :
- greatest > 0x00FF ? 5 : 3);
+ n *= 3 + (size_t)(greatest > 0x00FF ? 5 : 3);
if (ensure_send_buffer_size(top + n + 2) < 0)
return -1;