mirror of https://github.com/xzeldon/htop.git
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:
parent
a32d7528f6
commit
03f17688ad
2
Panel.c
2
Panel.c
|
@ -469,7 +469,7 @@ HandlerResult Panel_selectByTyping(Panel* this, int ch) {
|
||||||
this->eventHandlerState = xCalloc(100, sizeof(char));
|
this->eventHandlerState = xCalloc(100, sizeof(char));
|
||||||
char* buffer = this->eventHandlerState;
|
char* buffer = this->eventHandlerState;
|
||||||
|
|
||||||
if (ch < 255 && isalnum(ch)) {
|
if (ch > 0 && ch < 255 && isalnum(ch)) {
|
||||||
int len = strlen(buffer);
|
int len = strlen(buffer);
|
||||||
if (len < 99) {
|
if (len < 99) {
|
||||||
buffer[len] = ch;
|
buffer[len] = ch;
|
||||||
|
|
Loading…
Reference in New Issue