fix: leftover follow-x mode atoi - #1
Open
tonycoder-hub wants to merge 1 commit into
Open
Conversation
GetFollowXRule parses CUST_FOLLOW_X_RULES mode with atoi. atoi does not
reject trailing junk ("10abc" -> 10) or overflow, so a malformed system
parameter can select the wrong follow-x mode.
Parse with strtol via ParseFollowXMode (allow trailing ',' for the
USER_DEFINED extra path) and keep the caller's default mode on failure.
Signed-off-by: Tony Coder <407243179@qq.com>
OpenHarmonySCM-noreply
force-pushed
the
master
branch
2 times, most recently
from
September 3, 2026 05:07
5f93659 to
47f9d30
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.
Summary
GetFollowXRulereadsCUST_FOLLOW_X_RULESsystem-parameter segments and converts the mode field withatoi.atoidoes not reject trailing junk ("10abc"→ 10) or overflow, so a malformed parameter can select the wrong follow-x mode.Add
ParseFollowXMode(strtolwith end check) and use it inGetFollowXRule:,extra(USER_DEFINED extra path)FOLLOWX_MODE_DEFAULT)Test plan
0/1/10/11/12/100,100,extra/path, empty, signs, spaces, junk, overflowSigned-off-by: Tony Coder 407243179@qq.com