Fix format-truncation warnings
The following warnings are being addressed. - hbsUtil.cpp: The correct value for MAX_ENTRY_STR_LEN should be 13 this considering that values can be higher than 9999, the final space and the leading '\n'. - hwmonAlarm.cpp: As a result of a discussion with Eric Macdonald, he suggested to remove the entire case for FM_ALARM_STATE_CLEAR as the reason buffer is not used and thus, there's no need to store a string there. - pmonHdlr.cpp: A truncation warning was shown due to a possible usage of a unitialize buffer. The fix here is check by NULL. Change-Id: I3c80cce99b2f521f8c7a9de4ce2b6036960dfaf6 Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
This commit is contained in:
@@ -257,15 +257,7 @@ int hwmon_alarm_util ( string & hostname,
|
||||
"%s is reporting a '%s' out-of-tolerance reading from the '%s' sensor",
|
||||
hostname.c_str(), _getSev_str (severity).c_str(), sub_entity.c_str());
|
||||
|
||||
if ( state == FM_ALARM_STATE_CLEAR )
|
||||
{
|
||||
snprintf(alarm.reason_text, FM_MAX_BUFFER_LENGTH,
|
||||
"%s:%s alarm clear\n",
|
||||
alarm.alarm_id,
|
||||
alarm.entity_instance_id);
|
||||
hostname_prefix_in_reason = false ;
|
||||
}
|
||||
else if ( state == FM_ALARM_STATE_MSG )
|
||||
if ( state == FM_ALARM_STATE_MSG )
|
||||
{
|
||||
if ( severity == FM_ALARM_SEVERITY_WARNING )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user