Handle unexpected values for character passed to isalnum

It seems that certain negative integer values can crash isalnum().
Let's protect against those.

Fixes #711.
This commit is contained in:
Hisham Muhammad 2018-02-05 10:59:20 +01:00
parent a32d7528f6
commit 03f17688ad
1 changed files with 1 additions and 1 deletions

View File

@ -469,7 +469,7 @@ HandlerResult Panel_selectByTyping(Panel* this, int ch) {
this->eventHandlerState = xCalloc(100, sizeof(char));
char* buffer = this->eventHandlerState;
if (ch < 255 && isalnum(ch)) {
if (ch > 0 && ch < 255 && isalnum(ch)) {
int len = strlen(buffer);
if (len < 99) {
buffer[len] = ch;