[DragonFlyBSD - Bug #3015] (New) sbin/gpt/show.c:133: do we always find what we are looking for ?

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Tue Apr 11 11:11:20 PDT 2017


Issue #3015 has been reported by dcb.

----------------------------------------
Bug #3015: sbin/gpt/show.c:133: do we always find what we are looking for ?
http://bugs.dragonflybsd.org/issues/3015

* Author: dcb
* Status: New
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
dragonfly/sbin/gpt/show.c:133]: (error) Array 'mbr.mbr_part[4]' accessed at index 4, which is out of bounds.

Source code is

            for (i = 0; i < 4; i++) {
                start = le16toh(mbr->mbr_part[i].part_start_hi);
                start = (start << 16) +
                    le16toh(mbr->mbr_part[i].part_start_lo);
                if (m->map_start == p->map_start + start)
                    break;
            }
            printf("%d", mbr->mbr_part[i].part_typ);

In the final printf, the code assumes we have found what we are looking for.

Maybe the code would be stronger if it dealt with the case where it didn't.




-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Bugs mailing list