libnvme: examples: validate AE numbers in mi-mctp-ae - #3915
Open
prabhakarpujeri wants to merge 1 commit into
Open
libnvme: examples: validate AE numbers in mi-mctp-ae#3915prabhakarpujeri wants to merge 1 commit into
prabhakarpujeri wants to merge 1 commit into
Conversation
Port of linux-nvme/libnvme#1127. atoi() results were used unchecked to index the 256-entry aem_config.enabled_map.enabled[] array on the stack, so a value outside 0-255 (or negative) is an out-of-bounds stack write. Reject them. Lift 'argc == 4' to 'argc >= 4' so more than one AE can actually be enabled per the usage text. Signed-off-by: Prabhakar Pujeri <prabhakar.pujeri@dell.com>
prabhakarpujeri
force-pushed
the
fix-mi-mctp-ae-args
branch
from
August 26, 2026 13:34
b49d964 to
4c29279
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Port of linux-nvme/libnvme#1127 to libnvme3: the example in this tree has the identical argv-parsing bug as the 1.x version:
atoi()values index the 256-entryaem_config.enabled_map.enabled[]stack array unchecked (OOB stack write for out-of-range / negative inputs), andargc == 4accepts exactly one AE number although the usage text ([AE #s separated by spaces]) and the loop are written for a variable count.Fix
argc == 4toargc >= 4, matching the documented usage.Testing