summaryrefslogtreecommitdiffstats
path: root/apps/plugins/lua/rocklib.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/rocklib.c')
-rw-r--r--apps/plugins/lua/rocklib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 050fbc73b2..2672d446fc 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -153,7 +153,7 @@ RB_WRAP(kbd_input)
const char *input = lua_tostring(L, 1);
size_t layout_len;
- const char *layout = lua_tolstring(L, 2, &layout_len);
+ const unsigned char *layout = lua_tolstring(L, 2, &layout_len);
char *buffer = luaL_prepbuffer(&b);
if(input != NULL)
@@ -161,8 +161,12 @@ RB_WRAP(kbd_input)
else
buffer[0] = '\0';
- if(layout_len <= 1 || (unsigned short)layout[layout_len - 1] != 0xFFFE)
+ if(layout_len <= 2 ||
+ layout[layout_len - 1] != 0xFE ||
+ layout[layout_len - 2] != 0xFF)
+ {
layout = NULL;
+ }
if(!rb->kbd_input(buffer, LUAL_BUFFERSIZE, (unsigned short *)layout))
{