File tree Expand file tree Collapse file tree
cpp/ql/src/experimental/Security/CWE/CWE-243 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313
1414import cpp
1515
16- /** Holds if a `fc` function call is available before or before a `chdir` function call. */
16+ /** Holds if a `fc` function call is available before or after a `chdir` function call. */
1717predicate inExistsChdir ( FunctionCall fcp ) {
1818 exists ( FunctionCall fctmp |
1919 (
5454 not inExistsChdir ( fctmp ) and
5555 not outExistsChdir ( fctmp )
5656 ) and
57- msg = "Creation of chroot Jail Without Changing Working Directory out "
57+ msg = "Creation of ' chroot' jail without changing the working directory "
5858 or
5959 (
6060 fc .getTarget ( ) .hasGlobalOrStdName ( "chdir" ) or
6565 not exists ( ReturnStmt rttmp | rttmp .getExpr ( ) .getAChild * ( ) = fc ) and
6666 not exists ( Assignment astmp | astmp .getAChild * ( ) = fc ) and
6767 not exists ( Initializer ittmp | ittmp .getExpr ( ) .getAChild * ( ) = fc ) and
68- not fc . isInMacroExpansion ( ) and
69- msg = fc .getTarget ( ) .getName ( ) + " unchecked return value ."
68+ not isFromMacroDefinition ( fc )
69+ msg = "Unchecked return value for call to '" + fc .getTarget ( ) .getName ( ) + "' ."
7070select fc , msg
You can’t perform that action at this time.
0 commit comments