Fix ipmi FRU parser to give up once malformed data is encountered

This commit is contained in:
Jarrod Johnson 2013-08-12 16:04:08 -04:00
parent 16be3f4902
commit d6ce28f954

View File

@ -2772,6 +2772,7 @@ sub parseprod {
}
$idx+=$currsize;
($currsize,$currdata,$encode)=extractfield(\@area,$idx);
if ($currsize < 0) { last }
}
return \%info;
@ -2844,6 +2845,7 @@ sub parseboard {
}
$idx+=$currsize;
($currsize,$currdata,$encode)=extractfield(\@area,$idx);
if ($currsize < 0) { last }
}
if ($global_sessdata->{isanimm}) { #we can understand more specifically some of the extra fields...
$boardinf{frunum}=$boardinf{extra}->[0]->{value};
@ -2908,6 +2910,7 @@ sub parsechassis {
}
$idx+=$currsize;
($currsize,$currdata,$encode)=extractfield(\@chassarea,$idx);
if ($currsize < 0) { last }
}
return \%chassisinf;
}
@ -2919,7 +2922,7 @@ sub extractfield { #idx is location of the type/length byte, returns something a
my $data;
if ($idx >= scalar @$area) {
xCAT::SvrUtils::sendmsg([1,"Error parsing FRU data from BMC"],$callback);
return 1,undef,undef;
return -1,undef,undef;
}
my $size = $area->[$idx] & 0b00111111;
my $encoding = ($area->[$idx] & 0b11000000)>>6;