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

StrSize() usage checking #6412

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pierregondois
Copy link
Contributor

Description

Replace StrSize by StrLen and add comments about StrSize usage.

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

StrSize() account the terminating NULL character and cannot return 0.
Replace StrSize() StrLen().

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4859
Reported-by: Tormod Volden <[email protected]>
Signed-off-by: Pierre Gondois <[email protected]>
StrSize() cannot return 0. As done in other packages, StrSize()
checks the length of the string doesn't exceed
PcdMaximumUnicodeStringLength. Add comments to make it more obvious.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4859
Reported-by: Tormod Volden <[email protected]>
Signed-off-by: Pierre Gondois <[email protected]>
Copy link
Contributor

@samimujawar samimujawar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for these fixes.
These changes look good to me.

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.

2 participants