mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
fix calloc() calls
* size_t nmemb (number of elements) first, then size_t size * do not assume char is size 1 but use sizeof() * allocate for char, not pointer to char (found by Michael McConville, fixes #261)
This commit is contained in:
2
Panel.c
2
Panel.c
@ -455,7 +455,7 @@ bool Panel_onKey(Panel* this, int key) {
|
||||
HandlerResult Panel_selectByTyping(Panel* this, int ch) {
|
||||
int size = Panel_size(this);
|
||||
if (!this->eventHandlerState)
|
||||
this->eventHandlerState = calloc(100, 1);
|
||||
this->eventHandlerState = calloc(100, sizeof(char));
|
||||
char* buffer = this->eventHandlerState;
|
||||
|
||||
if (ch < 255 && isalnum(ch)) {
|
||||
|
Reference in New Issue
Block a user