mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Fix array limit.
This commit is contained in:
parent
e0209da88f
commit
659251c501
@ -56,13 +56,14 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
|
||||
if (!batteryDir)
|
||||
return 0;
|
||||
|
||||
char* batteries[64];
|
||||
#define MAX_BATTERIES 64
|
||||
char* batteries[MAX_BATTERIES];
|
||||
unsigned int nBatteries = 0;
|
||||
memset(batteries, sizeof batteries, sizeof (char*));
|
||||
memset(batteries, MAX_BATTERIES, sizeof (char*));
|
||||
|
||||
struct dirent result;
|
||||
struct dirent* dirEntry;
|
||||
while (nBatteries < sizeof batteries) {
|
||||
while (nBatteries < MAX_BATTERIES) {
|
||||
readdir_r(batteryDir, &result, &dirEntry);
|
||||
if (!dirEntry)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user