Cap namelen

This commit is contained in:
buffet 2020-01-06 16:47:33 +00:00
parent c795459bb4
commit 525ff083b1

View file

@ -78,9 +78,11 @@ kiwmi_keyboard_on_key_down_or_up_notify(
for (int i = 0; i < nsyms; ++i) { for (int i = 0; i < nsyms; ++i) {
xkb_keysym_t sym = syms[i]; xkb_keysym_t sym = syms[i];
int namelen = size_t namelen =
xkb_keysym_get_name(sym, keysym_name, sizeof(keysym_name)); xkb_keysym_get_name(sym, keysym_name, sizeof(keysym_name));
namelen = namelen > sizeof(keysym_name) ? sizeof(keysym_name) : namelen;
lua_rawgeti(L, LUA_REGISTRYINDEX, lc->callback_ref); lua_rawgeti(L, LUA_REGISTRYINDEX, lc->callback_ref);
lua_newtable(L); lua_newtable(L);