Commit 659251c5 authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

Fix array limit.

parent e0209da8
Showing with 4 additions and 3 deletions
+4 -3
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment