ID: 3528368 - 'lib/ipmi_sdr.c' - possible int *flow

Commit fixes possible int *flow in ipmi_sdr_print_type() in 'lib/ipmi_sdr.c'.
str2uchar() is used instead of strtol() which wasn't being checked for errors.

Reported by: Duncan Idaho
This commit is contained in:
Zdenek Styblik 2012-11-11 18:26:36 +00:00
parent 2edc474cef
commit 5b90f68407

View File

@ -4323,7 +4323,12 @@ ipmi_sdr_print_type(struct ipmi_intf *intf, char *type)
if (strncmp(type, "0x", 2) == 0) {
/* begins with 0x so let it be entered as raw hex value */
sensor_type = (uint8_t) strtol(type, NULL, 0);
if (str2uchar(type, &sensor_type) != 1) {
lprintf(LOG_ERR,
"Given type of sensor \"%s\" is either invalid or out of range.",
type);
return (-1);
}
} else {
for (x = 1; x < SENSOR_TYPE_MAX; x++) {
if (strncasecmp(sensor_type_desc[x], type,