File tree Expand file tree Collapse file tree
cpp/ql/src/semmle/code/cpp/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ private import implementations.Fread
12private import implementations.IdentityFunction
23private import implementations.Inet
34private import implementations.Memcpy
Original file line number Diff line number Diff line change 1+ import semmle.code.cpp.models.interfaces.Alias
2+
3+ class Fread extends AliasFunction {
4+ Fread ( ) {
5+ this .hasGlobalName ( "fread" )
6+ }
7+
8+ override predicate parameterNeverEscapes ( int n ) {
9+ n = 0 or
10+ n = 3
11+ }
12+
13+ override predicate parameterEscapesOnlyViaReturn ( int n ) { none ( ) }
14+
15+ override predicate parameterIsAlwaysReturned ( int n ) { none ( ) }
16+ }
Original file line number Diff line number Diff line change 11import semmle.code.cpp.models.interfaces.FormattingFunction
2+ import semmle.code.cpp.models.interfaces.Alias
23
34/**
45 * The standard functions `printf`, `wprintf` and their glib variants.
56 */
6- class Printf extends FormattingFunction {
7+ class Printf extends FormattingFunction , AliasFunction {
78 Printf ( ) {
89 this instanceof TopLevelFunction and
910 (
@@ -22,6 +23,14 @@ class Printf extends FormattingFunction {
2223 hasGlobalOrStdName ( "wprintf" ) or
2324 hasGlobalName ( "wprintf_s" )
2425 }
26+
27+ override predicate parameterNeverEscapes ( int n ) {
28+ n = 0
29+ }
30+
31+ override predicate parameterEscapesOnlyViaReturn ( int n ) { none ( ) }
32+
33+ override predicate parameterIsAlwaysReturned ( int n ) { none ( ) }
2534}
2635
2736/**
You can’t perform that action at this time.
0 commit comments