summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipmi_fru_info_area.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/ipmi_fru_info_area.cpp b/ipmi_fru_info_area.cpp
index 1951f8c..ca3fa64 100644
--- a/ipmi_fru_info_area.cpp
+++ b/ipmi_fru_info_area.cpp
@@ -40,7 +40,10 @@ static constexpr uint8_t typeASCII = 0xC0;
static constexpr auto maxRecordAttributeValue = 0x1F;
static constexpr auto secs_from_1970_1996 = 820454400;
+static constexpr auto maxMfgDateValue = 0xFFFFFF; //3 Byte length
static constexpr auto secs_per_min = 60;
+static constexpr auto
+ secsToMaxMfgdate = secs_from_1970_1996 + secs_per_min * maxMfgDateValue;
/**
* @brief Format Beginning of Individual IPMI FRU Data Section
@@ -160,7 +163,7 @@ void appendMfgDate(const PropertyMap& propMap, FruAreaData& data)
{
//MFG Date/Time
auto iter = propMap.find(buildDate);
- if (iter != propMap.end())
+ if ((iter != propMap.end()) && (iter->second.size() > 0))
{
tm time = {};
strptime(iter->second.c_str(), "%F - %H:%M:%S", &time);
@@ -171,7 +174,7 @@ void appendMfgDate(const PropertyMap& propMap, FruAreaData& data)
// Number of minutes from 0:00 hrs 1/1/96.
// LSbyte first (little endian)
// 00_00_00h = unspecified."
- if (raw > secs_from_1970_1996)
+ if ((raw >= secs_from_1970_1996) && (raw <= secsToMaxMfgdate))
{
raw -= secs_from_1970_1996;
raw /= secs_per_min;
OpenPOWER on IntegriCloud