Fix missing index check for Tokenizer_GetArg functions #2058
Merged
openshwprojects merged 3 commits intoopenshwprojects:mainfrom Apr 4, 2026
Merged
Fix missing index check for Tokenizer_GetArg functions #2058openshwprojects merged 3 commits intoopenshwprojects:mainfrom
openshwprojects merged 3 commits intoopenshwprojects:mainfrom
Conversation
Tokenizer_GetArgIntegerRange() need to agree an return value in this cas. I choosed range_Min
Tokenizer_GetArgInteger()
Tokenizer_GetArgFloat()
Added check for negative index to all TokenizerGetXX functions
Added selftest for these cases to selftest_tokenizer.c
Tried to fix selftest_tasmota.c - it relayed on the previous behavior to return a value from a prevoius "TokenizeString()" call
Examlpe of what was changed:
- SIM_SendFakeMQTTAndRunSimFrame_CMND("CT", "");
+ SIM_SendFakeMQTTAndRunSimFrame_CMND("CT", "153");
(later 153 is used for "assert" in
SELFTEST_ASSERT_JSON_VALUE_INTEGER(0, "CT", 153);
)
Safeguarding command in src/cmnds/cmd_newLEDDriver.c (reject calls with insufficient number of arguments) Make "0" default "addMode" for "add_dimmer()"
openshwprojects
approved these changes
Apr 4, 2026
|
🎉 This PR is included in version 1.18.283 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Fix missing "safeguard" for invalid argument index for
Tokenizer_GetArgIntegerRange() // need to agree the return value in this case. I choose range_Min
Tokenizer_GetArgInteger() // return 0 if index is invalid
Tokenizer_GetArgFloat() // return 0.0 if index is invalid
Added check for negative index to all TokenizerGetXX functions
Added selftest for these cases to selftest_tokenizer.c
Tried to fix selftest_tasmota.c - it relayed on the previous behavior to return a value from a previous "TokenizeString()" call
Example of what was changed:
(later 153 is used for "assert" in
SELFTEST_ASSERT_JSON_VALUE_INTEGER(0, "CT", 153);
)