Skip to content

Commit 6a19497

Browse files
committed
C++: respond to more PR comments
1 parent 4018ed6 commit 6a19497

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

cpp/ql/src/Security/CWE/CWE-022/TaintedPath.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ class FileFunction extends FunctionWithWrappers {
3434
nme.matches("CreateFile%")
3535
)
3636
or
37-
this.hasStdName("fopen")
37+
this.hasQualifiedName("std", "fopen")
3838
or
3939
// on any of the fstream classes, or filebuf
40-
exists(string nme | this.getDeclaringType().hasStdName(nme) |
40+
exists(string nme | this.getDeclaringType().hasQualifiedName("std", nme) |
4141
nme = "basic_fstream" or
4242
nme = "basic_ifstream" or
4343
nme = "basic_ofstream" or

cpp/ql/src/semmle/code/cpp/Declaration.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,13 @@ abstract class Declaration extends Locatable, @declaration {
122122

123123
/** Holds if this declaration has the given name in the `std` namespace. */
124124
predicate hasStdName(string name) {
125-
this.hasQualifiedName("std", "", name)
126125
}
127126

128127
/** Holds if this declaration has the given name in the global namespace or the `std` namespace. */
129128
predicate hasGlobalOrStdName(string name) {
130129
this.hasGlobalName(name)
131130
or
132-
this.hasStdName(name)
131+
this.hasQualifiedName("std", "", name)
133132
}
134133

135134
/** Gets a specifier of this declaration. */

cpp/ql/src/semmle/code/cpp/commons/File.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import cpp
66
predicate fopenCall(FunctionCall fc) {
77
exists(Function f | f = fc.getTarget() |
88
f.hasGlobalOrStdName("fopen") or
9-
f.hasGlobalOrStdName("open") or
9+
f.hasGlobalName("open") or
1010
f.hasGlobalName("_open") or
1111
f.hasGlobalName("_wopen") or
1212
f.hasGlobalName("CreateFile") or

0 commit comments

Comments
 (0)