ID:446 - Fix broken firewall reset iterator

The netfn structures are populated sequentially in the _gather_info
function and they are accessed only by even indices (and to the double
of its real length). This results in a segmentation fault if you run

* ipmitool firewall reset

This patch fixes the behaviour so that the ipmi_firewall_reset function
treats the structure the same way as the rest of the code does.

Signed-off-by: Boris Ranto <branto@redhat.com>
This commit is contained in:
Boris Ranto 2016-05-31 18:36:32 +02:00 committed by Zdenek Styblik
parent 0fdfbce8b6
commit c89be0354a

View File

@ -1135,8 +1135,8 @@ ipmi_firewall_reset(struct ipmi_intf * intf, int argc, char ** argv)
for (l=0; l<MAX_LUN; l++) {
p.lun = l;
for (n=0; n<MAX_NETFN; n+=2) {
p.netfn = n;
for (n=0; n<MAX_NETFN_PAIR; n++) {
p.netfn = n*2;
for (c=0; c<MAX_COMMAND; c++) {
p.command = c;
printf("reset lun %d, netfn %d, command %d, subfn\n", l, n, c);