summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkarl <karl>2005-01-27 16:52:59 +0000
committerkarl <karl>2005-01-27 16:52:59 +0000
commit30b933e69c8b9555847a3b8b63c64618c98c8408 (patch)
treeeafe7603b425b8f442236086609df6572619ac2d
parent2eec402d3292999cf57a4148d476c9c90e344384 (diff)
downloadtog-pegasus-SLPPERFINST-branch.zip
tog-pegasus-SLPPERFINST-branch.tar.gz
tog-pegasus-SLPPERFINST-branch.tar.xz
TITLE: buffers used with sprintf are all one character too short and every creation of datetime from sint64 time overflows the buffers with the sprintf calls. DESCRIPTION:
-rw-r--r--src/Pegasus/ControlProviders/Statistic/CIMOMStatDataProvider.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Pegasus/ControlProviders/Statistic/CIMOMStatDataProvider.cpp b/src/Pegasus/ControlProviders/Statistic/CIMOMStatDataProvider.cpp
index e64e709..56cc1d2 100644
--- a/src/Pegasus/ControlProviders/Statistic/CIMOMStatDataProvider.cpp
+++ b/src/Pegasus/ControlProviders/Statistic/CIMOMStatDataProvider.cpp
@@ -240,7 +240,7 @@ CIMDateTime CIMOMStatDataProvider::toDateTime(Sint64 date)
Sint64 ndays = date/oneDay; //one day = 8.64*10^10 millisecond
Sint64 rem = date % oneDay; //rem_1 is remander of above operation
- char buf_day[8];
+ char buf_day[9];
sprintf(buf_day,"%08d",(int)ndays);
String test = String(buf_day);
@@ -248,7 +248,7 @@ String test = String(buf_day);
Sint64 nhour = rem/PEGASUS_UINT64_LITERAL(3600000000); //one hour = 3.6*10^9 milliseconds
Sint64 rem_2 = rem%PEGASUS_UINT64_LITERAL(3600000000); //rem_2 is remander of above operation
- char buf_hour[2];
+ char buf_hour[3];
sprintf(buf_hour,"%02d",(int)nhour);
String hour = String(buf_hour);
@@ -257,14 +257,14 @@ String dh = test.append(String(buf_hour));
Sint64 nmin = rem_2/60000000; // one minute = 6*10^7
Sint64 rem_3 = rem_2%60000000;
- char buf_minute[2];
+ char buf_minute[3];
sprintf(buf_minute,"%02d",(int)nmin);
String dhm = dh.append(String(buf_minute));
//printf("after second append this is test %s\n", test.getCString());
Sint64 nsecond = rem_3/1000000; //one second = 10^6 milliseconds
- char buf_second[2];
+ char buf_second[3];
sprintf(buf_second,"%02d",(int)nsecond);
String dhms = dhm.append(String(buf_second));
@@ -272,7 +272,7 @@ String dhms = dhm.append(String(buf_second));
Sint64 nmilsec = rem_3%1000000;
- char buf_milsec[11];
+ char buf_milsec[20];
sprintf(buf_milsec,".%06d:000",(int)nmilsec);
String dhmsm = dhms.append(String(buf_milsec));