Skip to content

Commit 6db75df

Browse files
authored
Merge pull request #5186 from geoffw0/modelsbsl4
C++: More models work
2 parents 408ac27 + 58230d6 commit 6db75df

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

cpp/ql/src/semmle/code/cpp/models/implementations/Fread.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import semmle.code.cpp.models.interfaces.Alias
22
import semmle.code.cpp.models.interfaces.FlowSource
33

44
private class Fread extends AliasFunction, RemoteFlowSourceFunction {
5-
Fread() { this.hasGlobalName("fread") }
5+
Fread() { this.hasGlobalOrStdOrBslName("fread") }
66

77
override predicate parameterNeverEscapes(int n) {
88
n = 0 or

cpp/ql/src/semmle/code/cpp/models/implementations/Getenv.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import semmle.code.cpp.models.interfaces.FlowSource
99
* The POSIX function `getenv`.
1010
*/
1111
class Getenv extends LocalFlowSourceFunction {
12-
Getenv() { this.hasGlobalName("getenv") }
12+
Getenv() { this.hasGlobalOrStdOrBslName("getenv") }
1313

1414
override predicate hasLocalFlowSource(FunctionOutput output, string description) {
1515
(

cpp/ql/src/semmle/code/cpp/models/implementations/Gets.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ private class GetsFunction extends DataFlowFunction, TaintFunction, ArrayFunctio
1919
// gets(str)
2020
// fgets(str, num, stream)
2121
// fgetws(wstr, num, stream)
22-
hasGlobalOrStdName(["gets", "fgets", "fgetws"])
22+
hasGlobalOrStdOrBslName(["gets", "fgets", "fgetws"])
2323
}
2424

2525
override predicate hasDataFlow(FunctionInput input, FunctionOutput output) {
@@ -54,13 +54,13 @@ private class GetsFunction extends DataFlowFunction, TaintFunction, ArrayFunctio
5454
}
5555

5656
override predicate hasArrayWithVariableSize(int bufParam, int countParam) {
57-
not hasGlobalOrStdName("gets") and
57+
not hasName("gets") and
5858
bufParam = 0 and
5959
countParam = 1
6060
}
6161

6262
override predicate hasArrayWithUnknownSize(int bufParam) {
63-
hasGlobalOrStdName("gets") and
63+
hasName("gets") and
6464
bufParam = 0
6565
}
6666

0 commit comments

Comments
 (0)