HomeFreeBSD

pci: propagate vpd read error

Description

pci: propagate vpd read error

On read error, we would return -1, but not handle it, causing a zero
size malloc of value, and then we wouldd unconditionally write
value[-1 + 1] = '\0'. This should be harmless in terms of buffer
overflow because we should get a minimum non-zero size allocation from
malloc, but it also effectively swallowed the error.

Reported by: GCC -Wstringop-overflow
Reviewed by: kib, se
Differential Revision: https://reviews.freebsd.org/D45895

Details

Provenance
rlibbyAuthored on Jul 7 2024, 11:46 PM
Reviewer
kib
Differential Revision
D45895: pci: propagate vpd read error
Parents
rGf7f9a033f3ec: rtld: quiet gcc -Wrestrict
Branches
Unknown
Tags
Unknown