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

Add length check on command line input #1559

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

celine-lee
Copy link
Contributor

My team and I were looking through the Ventoy source code using our AI-based source code anomaly detection tool, MP-CodeCheck, and found this line that, while currently functioning correctly, may benefit from a slight adjustment for the sake of maintainability: a check on the length of the input string argv[1] before checking its first two characters.

This way, a developer who may modify this line in the future, especially if the program checks for longer string prefixes, will be more likely to be conscious of valid string checking to avoid undefined behavior.

@ventoy
Copy link
Owner

ventoy commented Apr 6, 2022

IMHO, the check is unnecessary because of short-circuiting in if statement.

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