Skip to content

Commit 5c084f8

Browse files
author
Robert Marsh
committed
C++: respond to more PR comments
1 parent 4018ed6 commit 5c084f8

3 files changed

Lines changed: 4 additions & 10 deletions

File tree

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 & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,11 @@ abstract class Declaration extends Locatable, @declaration {
119119
/** Holds if this declaration has the given name in the global namespace. */
120120
predicate hasGlobalName(string name) { this.hasQualifiedName("", "", name) }
121121

122-
123-
/** Holds if this declaration has the given name in the `std` namespace. */
124-
predicate hasStdName(string name) {
125-
this.hasQualifiedName("std", "", name)
126-
}
127-
128122
/** Holds if this declaration has the given name in the global namespace or the `std` namespace. */
129123
predicate hasGlobalOrStdName(string name) {
130124
this.hasGlobalName(name)
131125
or
132-
this.hasStdName(name)
126+
this.hasQualifiedName("std", "", name)
133127
}
134128

135129
/** 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)