Page MenuHomeFreeBSD

libefivar: Fix a buffer overread.
ClosedPublic

Authored by jhb on Sep 29 2022, 10:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 11, 1:35 AM
Unknown Object (File)
Fri, Oct 10, 6:55 PM
Unknown Object (File)
Fri, Oct 10, 6:55 PM
Unknown Object (File)
Fri, Oct 10, 7:10 AM
Unknown Object (File)
Tue, Sep 30, 10:54 PM
Unknown Object (File)
Thu, Sep 25, 5:00 AM
Unknown Object (File)
Wed, Sep 17, 2:09 PM
Unknown Object (File)
Sep 9 2025, 7:11 PM
Subscribers
None

Details

Summary

DevPathToTextUsbWWID allocates a separate copy of the SerialNumber
string to append a null terminator if the original string is not
null terminated. However, by using AllocateCopyPool, it tries to
copy 'Length + 1' words from the existing string containing 'Length'
characters into the target string. Split the copy out to only
copy 'Length' characters instead.

Reported by: GCC 12 -Wstringop-overread

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Sep 29 2022, 10:36 PM
jhb created this revision.

Change looks good to me...

But this is 'upstream' code hiding here. It comes from edk2.

So this needs to be upstreamed to MdePkg/Library/UefiDevicePathLib/DevicePathToText.c

I'll bet that this code has never been called on freeBSD though :)

This revision is now accepted and ready to land.Sep 30 2022, 2:56 AM

Upstream PR: https://github.com/tianocore/edk2/pull/3437

Their docs claim I need to join a mailings list and mail the patch there. I'll try just doing a PR first as I don't want all that e-mail.

This revision was automatically updated to reflect the committed changes.