Skip to content

Fix heap buffer overflow with -x option#634

Merged
jserv merged 1 commit into
sysprog21:masterfrom
visitorckw:fix-virtio-blk-overflow
Dec 4, 2025
Merged

Fix heap buffer overflow with -x option#634
jserv merged 1 commit into
sysprog21:masterfrom
visitorckw:fix-virtio-blk-overflow

Conversation

@visitorckw

@visitorckw visitorckw commented Dec 3, 2025

Copy link
Copy Markdown
Collaborator

The opt_virtio_blk_img array can be overflowed if more than VBLK_DEV_MAX virtio-blk devices are specified using the -x option, as opt_virtio_blk_idx is incremented without bounds checking.

Add a check to ensure that opt_virtio_blk_idx does not exceed VBLK_DEV_MAX. If the limit is reached, log an error and exit.


Summary by cubic

Prevent heap buffer overflow when too many virtio-blk devices are passed via -x. Adds a bounds check on opt_virtio_blk_idx; if it reaches VBLK_DEV_MAX, log an error and exit.

Written for commit e11b229. Summary will update automatically on new commits.

The opt_virtio_blk_img array can be overflowed if more than
VBLK_DEV_MAX virtio-blk devices are specified using the -x option, as
opt_virtio_blk_idx is incremented without bounds checking.

Add a check to ensure that opt_virtio_blk_idx does not exceed
VBLK_DEV_MAX. If the limit is reached, log an error and exit.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 1 file

@jserv jserv merged commit 0358490 into sysprog21:master Dec 4, 2025
9 of 11 checks passed
@jserv

jserv commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

Thank @visitorckw for contributing!

@jserv jserv added this to the release-2026.1 milestone Jan 2, 2026
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