Skip to content

Commit 738354b

Browse files
ihsinmeMathiasVP
andauthored
Update cpp/ql/src/experimental/Security/CWE/CWE-243/IncorrectChangingWorkingDirectory.ql
Co-authored-by: Mathias Vorreiter Pedersen <[email protected]>
1 parent 9b8b916 commit 738354b

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-243/IncorrectChangingWorkingDirectory.ql

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ where
6363
fc.getTarget().hasGlobalOrStdName("chdir") or
6464
fc.getTarget().hasGlobalOrStdName("fchdir")
6565
) and
66-
not exists(ConditionalStmt cotmp | cotmp.getControllingExpr().getAChild*() = fc) and
67-
not exists(Loop lptmp | lptmp.getCondition().getAChild*() = fc) and
68-
not exists(ReturnStmt rttmp | rttmp.getExpr().getAChild*() = fc) and
69-
not exists(Assignment astmp | astmp.getAChild*() = fc) and
70-
not exists(Initializer ittmp | ittmp.getExpr().getAChild*() = fc) and
66+
fc instanceof ExprInVoidContext
7167
not isFromMacroDefinition(fc) and
7268
msg = "Unchecked return value for call to '" + fc.getTarget().getName() + "'."
7369
select fc, msg

0 commit comments

Comments
 (0)