Skip to content

Commit 01d8ad9

Browse files
committed
C++: Model secure_getenv and _wgetenv as local flow sources
1 parent 2ed8d5d commit 01d8ad9

File tree

1 file changed

+7
-3
lines changed
  • cpp/ql/lib/semmle/code/cpp/models/implementations

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
/**
2-
* Provides an implementation class modeling the POSIX function `getenv`.
2+
* Provides an implementation class modeling the POSIX function `getenv` and
3+
* various similar functions.
34
*/
45

56
import cpp
67
import semmle.code.cpp.models.interfaces.FlowSource
78

89
/**
9-
* The POSIX function `getenv`.
10+
* The POSIX function `getenv`, the GNU function `secure_getenv`, and the
11+
* Windows function `_wgetenv`.
1012
*/
1113
class Getenv extends LocalFlowSourceFunction {
12-
Getenv() { this.hasGlobalOrStdOrBslName("getenv") }
14+
Getenv() {
15+
this.hasGlobalOrStdOrBslName("getenv") or this.hasGlobalName(["secure_getenv", "_wgetenv"])
16+
}
1317

1418
override predicate hasLocalFlowSource(FunctionOutput output, string description) {
1519
(

0 commit comments

Comments
 (0)