diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2014-04-24 19:43:27 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2014-04-24 19:43:27 -0300 |
commit | 659251c501b0634ff49c0438970532b188633e95 (patch) | |
tree | c96add8c76bf8a026f288e86b6730ce11e8a1e96 /BatteryMeter.c | |
parent | e0209da88faf3b390d71ff174065abd407abfdfd (diff) |
Fix array limit.
Diffstat (limited to 'BatteryMeter.c')
-rw-r--r-- | BatteryMeter.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/BatteryMeter.c b/BatteryMeter.c index aed5f232..76ccbdaf 100644 --- a/BatteryMeter.c +++ b/BatteryMeter.c @@ -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; |