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

[Feature]: Refactor ProviderValueAsAscii() to allocate buffer with right size for each setting #43

Closed
wenbhou opened this issue Mar 2, 2023 · 0 comments · Fixed by #48
Assignees
Labels
type:feature-request A new feature proposal urgency:low Little to no impact

Comments

@wenbhou
Copy link
Contributor

wenbhou commented Mar 2, 2023

Feature Overview

For some DFCI setting, ProviderValueAsAscii function now uses predefined macros to allocate buffer which is not flexible if we add new setting with bigger size, causing string truncated.
The new feature is to refactor the function to remove following macros and allocate buffer with right size for each setting.

#define ENABLED_STRING_SIZE                (9)
#define ASSET_TAG_STRING_MAX_SIZE          (22)
#define SECURE_BOOT_ENUM_STRING_SIZE       (20)
#define SYSTEM_PASSWORD_STATE_STRING_SIZE  (30)
#define USB_PORT_STATE_STRING_SIZE         (20)

Solution Overview

Calculate new size of each setting and allocate buffer with the new size, then copy new value to the buffer.

Alternatives Considered

No response

Urgency

Low

Are you going to implement the feature request?

I will implement the feature

Do you need maintainer feedback?

No maintainer feedback needed

Anything else?

No response

@wenbhou wenbhou added state:needs-triage Needs to triaged to determine next steps type:feature-request A new feature proposal labels Mar 2, 2023
@github-actions github-actions bot added the urgency:low Little to no impact label Mar 2, 2023
@makubacki makubacki removed the state:needs-triage Needs to triaged to determine next steps label Mar 2, 2023
makubacki pushed a commit that referenced this issue Mar 10, 2023
## Description

Refactor ProviderValueAsAscii() and remove following macros to make it can allocate buffer with right size for each setting.
Fix #43

```
#define ENABLED_STRING_SIZE                (9)
#define ASSET_TAG_STRING_MAX_SIZE          (22)
#define SECURE_BOOT_ENUM_STRING_SIZE       (20)
#define SYSTEM_PASSWORD_STATE_STRING_SIZE  (30)
#define USB_PORT_STATE_STRING_SIZE         (20)
```

- [x] Impacts functionality?
  - **Functionality** - Does the change ultimately impact how firmware functions?
  - Examples: Add a new library, publish a new PPI, update an algorithm, ...
- [ ] Impacts security?
  - **Security** - Does the change have a direct security impact on an application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
  - **Breaking change** - Will anyone consuming this change experience a break
    in build or boot behavior?
  - Examples: Add a new library class, move a module to a different repo, call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
  - **Documentation** - Does the change contain explicit documentation additions
    outside direct code modifications (and comments)?
  - Examples: Update readme file, add feature readme file, link to documentation
    on an a separate Web page, ...

## How This Was Tested

Tested with SEMM tool. No regression seen.

## Integration Instructions

N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature-request A new feature proposal urgency:low Little to no impact
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants