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)
Thu, May 9, 10:32 AM
Unknown Object (File)
Wed, May 1, 10:28 PM
Unknown Object (File)
Wed, May 1, 10:28 PM
Unknown Object (File)
Wed, May 1, 10:28 PM
Unknown Object (File)
Thu, Apr 25, 1:31 PM
Unknown Object (File)
Apr 17 2024, 4:28 PM
Unknown Object (File)
Feb 14 2024, 11:24 AM
Unknown Object (File)
Feb 14 2024, 11:24 AM
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.