-
Notifications
You must be signed in to change notification settings - Fork 2k
C++: Model secure versions of scanf as flow sources
#21856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2902a19
C++: Add more scanf testing.
MathiasVP 16235d7
C++: Add a 'call' column to 'hasRemoteFlowSource' and 'hasLocalFlowSo…
MathiasVP 5add24b
C++: Add scanf_s models.
MathiasVP 5f10a88
C++: Handle size arguments in 'getOutputArgument'.
MathiasVP 19781e5
C++: Add change notes.
MathiasVP e6c5f94
C++: Add missing format string part in test.
MathiasVP 25d2039
C++: Add models for _scanf_s_l, wscanf_s and _wscanf_s_l.
MathiasVP a33af09
C++: Add models for _fscanf_s_l, fwscanf_s and _fwscanf_s_l.
MathiasVP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| category: minorAnalysis | ||
| --- | ||
| * Added flow source models for `scanf_s` and related functions. | ||
| * Added a `Call` column to `LocalFlowSourceFunction::hasLocalFlowSource` and `RemoteFlowSourceFunction::hasRemoteFlowSource`. The old predicates without a `Call` column continue to be supported. |
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
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
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
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
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
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
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
13 changes: 8 additions & 5 deletions
13
cpp/ql/test/library-tests/scanf/scanfFormatLiteral.expected
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| | test.c:18:2:18:6 | call to scanf | 0 | s | 0 | 0 | | ||
| | test.c:19:2:19:7 | call to fscanf | 0 | s | 10 | 10 | | ||
| | test.c:19:2:19:7 | call to fscanf | 1 | i | 0 | 0 | | ||
| | test.c:20:2:20:7 | call to sscanf | 0 | s | 0 | 0 | | ||
| | test.c:21:2:21:8 | call to swscanf | 0 | s | 10 | 10 | | ||
| | test.c:19:2:19:6 | call to scanf | 0 | s | 0 | 0 | | ||
| | test.c:20:2:20:7 | call to fscanf | 0 | s | 10 | 10 | | ||
| | test.c:20:2:20:7 | call to fscanf | 1 | i | 0 | 0 | | ||
| | test.c:21:2:21:7 | call to sscanf | 0 | s | 0 | 0 | | ||
| | test.c:22:2:22:8 | call to swscanf | 0 | s | 10 | 10 | | ||
| | test.c:23:2:23:8 | call to scanf_s | 0 | d | 0 | 0 | | ||
| | test.c:23:2:23:8 | call to scanf_s | 1 | s | 0 | 0 | | ||
| | test.c:23:2:23:8 | call to scanf_s | 2 | d | 0 | 0 | |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| | ms.cpp:17:3:17:8 | call to sscanf | 0 | 1 | ms.cpp:17:24:17:30 | %I64i | non-wide | | ||
| | test.c:18:2:18:6 | call to scanf | 0 | 0 | test.c:18:8:18:11 | %s | non-wide | | ||
| | test.c:19:2:19:7 | call to fscanf | 0 | 1 | test.c:19:15:19:23 | %10s %i | non-wide | | ||
| | test.c:20:2:20:7 | call to sscanf | 0 | 1 | test.c:20:19:20:28 | %*i%s%*s | non-wide | | ||
| | test.c:21:2:21:8 | call to swscanf | 0 | 1 | test.c:21:21:21:26 | %10s | wide | | ||
| | test.c:19:2:19:6 | call to scanf | 0 | 0 | test.c:19:8:19:11 | %s | non-wide | | ||
| | test.c:20:2:20:7 | call to fscanf | 0 | 1 | test.c:20:15:20:23 | %10s %i | non-wide | | ||
| | test.c:21:2:21:7 | call to sscanf | 0 | 1 | test.c:21:19:21:28 | %*i%s%*s | non-wide | | ||
| | test.c:22:2:22:8 | call to swscanf | 0 | 1 | test.c:22:21:22:26 | %10s | wide | | ||
| | test.c:23:2:23:8 | call to scanf_s | 0 | 0 | test.c:23:10:23:19 | %d %s %d | non-wide | |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.