Skip to content

Commit c3b1d7e

Browse files
ihsinmeMathiasVP
andauthored
Apply suggestions from code review
Co-authored-by: Mathias Vorreiter Pedersen <[email protected]>
1 parent 5d5d6bc commit c3b1d7e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import 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. */
1717
predicate inExistsChdir(FunctionCall fcp) {
1818
exists(FunctionCall fctmp |
1919
(
@@ -54,7 +54,7 @@ where
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
@@ -65,6 +65,6 @@ where
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() + "'."
7070
select fc, msg

0 commit comments

Comments
 (0)