From c070fc00d6a8f196e04326cb0c437b5f134f4f07 Mon Sep 17 00:00:00 2001 From: Zdenek Styblik Date: Tue, 5 Feb 2013 06:57:44 +0000 Subject: [PATCH] ID: 3600930 - 'lib/ipmi_sdr.c' - NULL dereference Commit fixes NULL dereference in 'lib/ipmi_sdr.c' by checking whether Sensor is type of 'full' or 'compact'. Fix by: Jim Mank Reported by: Ales Ledvinka --- ipmitool/lib/ipmi_sdr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ipmitool/lib/ipmi_sdr.c b/ipmitool/lib/ipmi_sdr.c index 1ada814..63fd6a6 100644 --- a/ipmitool/lib/ipmi_sdr.c +++ b/ipmitool/lib/ipmi_sdr.c @@ -1804,10 +1804,12 @@ ipmi_sdr_print_sensor_fc(struct ipmi_intf *intf, SENSOR_PRINT_THRESH(sr->full, "Lower non-critical", lower.non_critical, lnc); } ipmi_sdr_print_sensor_hysteresis(sensor, sr->full, - sr->full->threshold.hysteresis.positive, "Positive Hysteresis"); + sr->full ? sr->full->threshold.hysteresis.positive : + sr->compact->threshold.hysteresis.positive, "Positive Hysteresis"); ipmi_sdr_print_sensor_hysteresis(sensor, sr->full, - sr->full->threshold.hysteresis.negative, "Negative Hysteresis"); + sr->full ? sr->full->threshold.hysteresis.negative : + sr->compact->threshold.hysteresis.negative, "Negative Hysteresis"); print_sensor_min_max(sr->full);