Skip to content

[AzihsmDxe] Added out buf len guard for DecodeBytes and DecodeBytesPadded - #113

Merged
Maheer Aeron (maheeraeron) merged 1 commit into
microsoft:mainfrom
rajesh-gali:user/rajeshgali/azihsm_decode_outbuf_len
Sep 16, 2026
Merged

Maheer Aeron (maheeraeron) merged 1 commit into
microsoft:mainfrom
rajesh-gali:user/rajeshgali/azihsm_decode_outbuf_len

Conversation

@rajesh-gali

Copy link
Copy Markdown
Contributor

This pull request strengthens buffer overrun protections in the MBOR decoding routines by ensuring decoded data does not exceed the capacity of destination buffers. It does so by updating function signatures to accept buffer sizes, adding bounds checks, and updating all affected call sites and documentation accordingly.

API and bounds checking updates:

  • Updated the signatures of AziHsmMborDecodeBytes and AziHsmMborDecodePaddedBytes in both AziHsmMbor.c and AziHsmMbor.h to require a BufferSize parameter, reflecting the capacity of the destination buffer. [1] [2] [3] [4]
  • Added explicit checks in both decoding functions to verify that the decoded length does not exceed the provided buffer size, returning EFI_BUFFER_TOO_SMALL and logging an error if the check fails. [1] [2]

Call site adjustments:

  • Updated all calls to AziHsmMborDecodeBytes and AziHsmMborDecodePaddedBytes in AziHsmDdi.c to pass the appropriate buffer size, ensuring that the new bounds checks are enforced throughout the codebase. [1] [2] [3]

Documentation improvements:

  • Updated function documentation in AziHsmMbor.h to describe the new BufferSize parameter and clarify the conditions under which EFI_BUFFER_TOO_SMALL is returned. [1] [2]

@rajesh-gali Rajesh Gali (rajesh-gali) changed the title Added out buf len for DecodeBytes and DecodeBytes Padded [AzihsmDxe] Added out buf len guard for DecodeBytes and DecodeBytesPadded Sep 16, 2026
@maheeraeron
Maheer Aeron (maheeraeron) merged commit cca2c7d into microsoft:main Sep 16, 2026
14 checks passed
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