Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MdePkg: Fix a buffer overread. #3437

Closed
wants to merge 1 commit into from
Closed

Conversation

bsdjhb
Copy link

@bsdjhb bsdjhb commented Oct 3, 2022

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.

This was reported by GCC's -Wstringop-overread when compiling a copy of this routine included in a library on FreeBSD.

Signed-off-by: John Baldwin jhb@FreeBSD.org

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.

This was reported by GCC's -Wstringop-overread when compiling a copy
of this routine included in a library on FreeBSD.

Signed-off-by: John Baldwin <jhb@FreeBSD.org>
@heatd
Copy link
Member

heatd commented Oct 8, 2022

Hi, could you please post this patch in the EDK2 mailing list? As described in https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Process

We don't do reviews here

@lersek lersek closed this Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants