Potential fix for code scanning alert no. 7: Potentially overflowing call to snprintf#10
Draft
rzr wants to merge 2 commits into
Draft
Potential fix for code scanning alert no. 7: Potentially overflowing call to snprintf#10rzr wants to merge 2 commits into
rzr wants to merge 2 commits into
Conversation
This issue was reported by CodeQL, IMHOI the alert was over reacting because contents was already extracted in a separate directory (which is absent in tree, so there is no risk to override) An extra check would be to verify a signed asset (using GPG), along a ZWA public key shared in tree. Potential fix for code scanning alert no. 1: Artifact poisoning Origin: SiliconLabsSoftware#108 Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Relate-to: Z-Wave-Alliance/OSWG#48 (comment) Relate-to: SiliconLabsSoftware#67 Relate-to: https://github.com/rzr/z-wave-protocol-controller/security/code-scanning/1 Relate-to: https://cwe.mitre.org/data/definitions/829.html Releta-to: SiliconLabsSoftware#100 Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
…call to snprintf Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
02155b9 to
c1e7488
Compare
e7c64e2 to
a86e78d
Compare
f24e8cf to
8787f76
Compare
eb732ac to
31cb0ba
Compare
f91d9c4 to
8dcfa6b
Compare
9490678 to
cd913ee
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.
Potential fix for https://github.com/rzr/z-wave-protocol-controller/security/code-scanning/7
To fix the issue, we need to check the return value of each
snprintfcall to ensure it is within the bounds of the remaining buffer size. If the return value is negative (indicating an encoding error) or exceeds the remaining buffer size, we should stop further writes to the buffer to prevent overflows. This involves modifying allsnprintfcalls in the affected functions (zwapi_demo_application_handlerandzwapi_demo_application_controller_update) to include these checks.Suggested fixes powered by Copilot Autofix. Review carefully before merging.