fix: leftover spawn timeout atoi - #1
Open
tonycoder-hub wants to merge 1 commit into
Open
tonycoder-hub wants to merge 1 commit into
tonycoder-hub wants to merge 1 commit into
Conversation
GetSpawnTimeout uses atoi on a system-parameter string. atoi does not set errno on overflow or invalid input, so the errno check is dead. Negative or garbage values wrap when cast to uint32_t. Parse with strtoul via ParseSpawnTimeoutU32 and keep the default timeout on junk, overflow, or a value below the caller default. Signed-off-by: Tony Coder <407243179@qq.com>
tonycoder-hub
force-pushed
the
leftover-spawn-timeout-atoi
branch
from
August 31, 2026 03:43
86cb27b to
68c21ab
Compare
OpenHarmonySCM-noreply
force-pushed
the
master
branch
2 times, most recently
from
September 9, 2026 22:40
660f1a3 to
f296249
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
GetSpawnTimeoutreads a system parameter and converts it withatoi.atoidoes not seterrnoon overflow or invalid input, so the existingerrnocheck is dead. Negative or garbage parameter strings wrap when cast touint32_t.Add
ParseSpawnTimeoutU32(strtoul) and use it inGetSpawnTimeout:ERANGE, and values aboveUINT32_MAXdefdef, keepdef(same min-vs-default behavior as before)Test plan
Signed-off-by: Tony Coder 407243179@qq.com