Skip to content

Commit 0b9b6d7

Browse files
committed
Address review comments
1 parent 4d03082 commit 0b9b6d7

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
category: minorAnalysis
33
---
4-
* he `cpp/world-writable-file-creation` query now only detects `open` and `openat` calls with the `O_CREAT` or `O_TMPFILE` flag.
4+
* The `cpp/world-writable-file-creation` query now only detects `open` and `openat` calls with the `O_CREAT` or `O_TMPFILE` flag.

cpp/ql/lib/semmle/code/cpp/commons/unix/Constants.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ bindingset[input]
1313
int parseOctal(string input) {
1414
input.regexpMatch("0[0-7]+") and
1515
result =
16-
sum(int ix |
16+
strictsum(int ix |
1717
ix in [1 .. input.length()]
1818
|
1919
8.pow(input.length() - (ix + 1)) * input.charAt(ix).toInt()

cpp/ql/src/Security/CWE/CWE-732/FilePermissions.qll

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ int parseHex(string input) {
66
exists(string lowerCaseInput | lowerCaseInput = input.toLowerCase() |
77
lowerCaseInput.regexpMatch("0x[0-9a-f]+") and
88
result =
9-
sum(int ix |
9+
strictsum(int ix |
1010
ix in [2 .. input.length()]
1111
|
1212
16.pow(input.length() - (ix + 1)) * "0123456789abcdef".indexOf(lowerCaseInput.charAt(ix))
1313
)
1414
)
1515
}
1616

17+
/**
18+
* Gets the value defined by the `O_CREAT` macro if the macro
19+
* exists and if every definition defines the same value.
20+
*/
1721
int o_creat() {
1822
result =
1923
unique(int v |
@@ -23,6 +27,10 @@ int o_creat() {
2327
)
2428
}
2529

30+
/**
31+
* Gets the value defined by the `O_TMPFILE` macro if the macro
32+
* exists and if every definition defines the same value.
33+
*/
2634
int o_tmpfile() {
2735
result =
2836
unique(int v |

0 commit comments

Comments
 (0)