HomeFreeBSD

geom_part: Fix potential integer overflow when checking size of the table

Description

geom_part: Fix potential integer overflow when checking size of the table

hdr_entries and hdr_entsz are both uint32_t as defined in UEFI spec.
Current spec does not have upper limit of the number of partition
entries and the size of partition entry, it is potential that malicious
or corrupted GPT header read from untrusted source contains large size of
entry number or size.

PR: 266548
Reviewed by: oshogbo, cem, imp, markj
Approved by: kp (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36709

(cherry picked from commit 2e543af13ab3746c7626c53293c007c8747eff9d)
(cherry picked from commit 3070bedd3dc54196f48645966eb34bd3a9bf131d)

Details

Provenance
zleiAuthored on Dec 21 2022, 1:04 AM
Reviewer
oshogbo
Differential Revision
D36709: geom_part: Fix potential integer overflow when checking size of the table
Parents
rG61b426a0b6a8: geom_part: Check number of GPT entries and size of GPT entry
Branches
Unknown
Tags
Unknown