From 70cd5c2b88ca6b2f9966a5e9b3e8be19a938b7f7 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Sun, 3 Jan 2016 16:31:44 -0200 Subject: [PATCH] Check range when accessing keys table. Should fix #321. --- MainPanel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MainPanel.c b/MainPanel.c index 2e91a3c5..336cfa46 100644 --- a/MainPanel.c +++ b/MainPanel.c @@ -91,7 +91,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) { result = HANDLED; } else if (ch == 27) { return HANDLED; - } else if (ch != ERR && this->keys[ch]) { + } else if (ch != ERR && ch > 0 && ch < KEY_MAX && this->keys[ch]) { reaction |= (this->keys[ch])(this->state); result = HANDLED; } else if (isdigit(ch)) {