Fixing a batch of issues reported by Coverity#820
Merged
JacobBarthelmeh merged 5 commits intowolfSSL:masterfrom Jul 21, 2025
Merged
Fixing a batch of issues reported by Coverity#820JacobBarthelmeh merged 5 commits intowolfSSL:masterfrom
JacobBarthelmeh merged 5 commits intowolfSSL:masterfrom
Conversation
Contributor
ejohnstown
commented
Jul 21, 2025
- String not null terminated: 572834
- Dereference before null check: 572919 572847
- Buffer not null terminated: 572891
- Argument cannot be negative: 573009 572928 572868
1. Swap out strdup() for a malloc() and memcpy(). Then nul terminate the string before tokenizing. Fixes CID: 572834
1. When cleaning the path, check that the path pointer is not null before using it. 2. Move the strlen of path. 3. Remove the second check of path, and just loop over it. Fixed CID: 572847
1. After getting the user's pw info, don't check that the shell value is null. We've already use it at that point. Fixes CID: 572919
1. When copying the shell, leave a byte free in the dest buffer. Fill it with a null. Fixes CID: 572891
1. Due to not checking the result of fseek(), it is possible to try to malloc() -1 bytes of storage. Checking the return from fseek() and erring if negative. 2. Changing the check between the result of fseek() and fread() to match signedness. Adding some casting, as at that point the fseek() result is always positive. Fixes CIDs: 573009 572928 572868
JacobBarthelmeh
approved these changes
Jul 21, 2025
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.