Skip to content

Commit e8b34e0

Browse files
committed
C++: Add an AliasFunction model to 'system'.
1 parent 7fee2c2 commit e8b34e0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cpp/ql/src/semmle/code/cpp/security/CommandExecution.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import semmle.code.cpp.security.FunctionWithWrappers
66
/**
77
* A function for running a command using a command interpreter.
88
*/
9-
class SystemFunction extends FunctionWithWrappers, ArrayFunction {
9+
class SystemFunction extends FunctionWithWrappers, ArrayFunction, AliasFunction {
1010
SystemFunction() {
1111
hasGlobalOrStdName("system") or // system(command)
1212
hasGlobalName("popen") or // popen(command, mode)
@@ -21,6 +21,12 @@ class SystemFunction extends FunctionWithWrappers, ArrayFunction {
2121
override predicate hasArrayWithNullTerminator(int bufParam) { bufParam = 0 or bufParam = 1 }
2222

2323
override predicate hasArrayInput(int bufParam) { bufParam = 0 or bufParam = 1 }
24+
25+
override predicate parameterNeverEscapes(int index) { index = 0 or index = 1 }
26+
27+
override predicate parameterEscapesOnlyViaReturn(int index) { none() }
28+
29+
override predicate parameterIsAlwaysReturned(int index) { none() }
2430
}
2531

2632
/**

0 commit comments

Comments
 (0)