File tree Expand file tree Collapse file tree
semmle/code/cpp/commons/unix Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11---
22category : 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.
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ bindingset[input]
1313int 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 ( )
Original file line number Diff line number Diff 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+ */
1721int 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+ */
2634int o_tmpfile ( ) {
2735 result =
2836 unique( int v |
You can’t perform that action at this time.
0 commit comments