diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2009-06-02 04:49:26 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2009-06-02 04:49:26 +0000 |
commit | 1371ee28a7e953052e414dfd1641294852aa4458 (patch) | |
tree | 18a05f2b8aca590aa346b38028cb60b02b4f6571 | |
parent | b62f9cea6f32ccf7620854b52ad533c24e76e1f0 (diff) |
don't use unbounded operations
-rw-r--r-- | BatteryMeter.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/BatteryMeter.c b/BatteryMeter.c index b997e81c..e9e9940f 100644 --- a/BatteryMeter.c +++ b/BatteryMeter.c @@ -86,7 +86,7 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short const FILE *file; char line[50]; - sprintf((char *) infoPath, "%s%s/%s", batteryPath, newEntry->content, fileName); + snprintf((char *) infoPath, sizeof infoPath, "%s%s/%s", batteryPath, newEntry->content, fileName); if ((file = fopen(infoPath, "r")) == NULL) { return 0; @@ -135,7 +135,7 @@ static ACPresence chkIsOnline() { char statePath[50]; - sprintf((char *) statePath, "%s/%s/state", power_supplyPath, entryName); + snprintf((char *) statePath, sizeof statePath, "%s/%s/state", power_supplyPath, entryName); file = fopen(statePath, "r"); if (!file) { @@ -190,7 +190,7 @@ static ACPresence chkIsOnline() { } char onlinePath[50]; - sprintf((char *) onlinePath, "%s/%s/online", power_supplyPath, entryName); + snprintf((char *) onlinePath, sizeof onlinePath, "%s/%s/online", power_supplyPath, entryName); file = fopen(onlinePath, "r"); if (!file) { @@ -264,7 +264,7 @@ static double getSysBatData() { const char ueventPath[50]; - sprintf((char *) ueventPath, "%s%s/uevent", power_supplyPath, entryName); + snprintf((char *) ueventPath, sizeof ueventPath, "%s%s/uevent", power_supplyPath, entryName); FILE *file; if ((file = fopen(ueventPath, "r")) == NULL) { |