[Bug]: Out-of-Bounds Memory Access in Percent-Decoding Routine #10741
Labels
package:networkpkg
priority:high
Significant impact. Should be fixed as soon as possible.
state:needs-maintainer-feedback
state:needs-owner
state:needs-triage
type:bug
Something isn't working
Is there an existing issue for this?
Bug Type
Code first?
What packages are impacted?
NetworkPkg
Which targets are impacted by this bug?
DEBUG, NO-TARGET, NOOPT, RELEASE
Current Behavior
It was discovered that the percent-decoding loop in the boot file URL extraction function accesses memory beyond the allocated buffer. When a '%' character is encountered near the end of the string, the code assumes that at least two characters follow it. This assumption leads to reading from and writing to
*(BootFileNamePtr + 3)
without validating the existence of sufficient characters.PxeBcDhcp6.c:553ff
Expected Behavior
The function should verify that at least two characters follow the '%' before attempting to decode a percent-encoded sequence. Incomplete sequences should be handled gracefully—either by treating the '%' as a literal or by rejecting the input.
Steps To Reproduce
tftp://[::1]/filename%1
ortftp://[::1]/filename%
).PxeBcExtractBootFileUrl
function.Build Environment
Version Information
Urgency
High
Are you going to fix this?
Someone else needs to fix it
Do you need maintainer feedback?
Maintainer feedback requested
Anything else?
Here an implementation that checks if there are at least two characters after the '%'. This could possible replace lines 543ff of
PxeBcDhcp6.c
.The following code ignores '%' when there are at least not two additional characters. Another implementation could be to return an error in this case.
The text was updated successfully, but these errors were encountered: