Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9009a50

Browse files
committed
Java: Adjust comment style.
1 parent e781990 commit 9009a50

2 files changed

Lines changed: 8 additions & 29 deletions

File tree

java/ql/src/semmle/code/java/security/FileReadWrite.qll

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import java
44
* Holds if `fileAccess` is used in the `fileReadingExpr` to read the represented file.
55
*/
66
private predicate fileRead(VarAccess fileAccess, Expr fileReadingExpr) {
7-
/*
8-
* `fileAccess` used to construct a class that reads a file.
9-
*/
10-
7+
// `fileAccess` used to construct a class that reads a file.
118
exists(ClassInstanceExpr cie |
129
cie = fileReadingExpr and
1310
cie.getArgument(0) = fileAccess
@@ -21,11 +18,8 @@ private predicate fileRead(VarAccess fileAccess, Expr fileReadingExpr) {
2118
ma = fileReadingExpr and filesMethod = ma.getMethod()
2219
|
2320
(
24-
/*
25-
* Identify all method calls on the `Files` class that imply that we are reading the file
26-
* represented by the first argument.
27-
*/
28-
21+
// Identify all method calls on the `Files` class that imply that we are reading the file
22+
// represented by the first argument.
2923
filesMethod.getDeclaringType().hasQualifiedName("java.nio.file", "Files") and
3024
fileAccess = ma.getArgument(0) and
3125
(

java/ql/src/semmle/code/java/security/FileWritable.qll

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,15 @@ private EnumConstant getAContainedEnumConstant(Expr enumSetRef) {
6666
private VarAccess getFileForPathConversion(Expr pathExpr) {
6767
pathExpr.getType().(RefType).hasQualifiedName("java.nio.file", "Path") and
6868
(
69-
/*
70-
* Look for conversion from `File` to `Path` using `file.getPath()`.
71-
*/
72-
69+
// Look for conversion from `File` to `Path` using `file.getPath()`.
7370
exists(MethodAccess fileToPath |
7471
fileToPath = pathExpr and
7572
result = fileToPath.getQualifier() and
7673
fileToPath.getMethod().hasName("toPath") and
7774
fileToPath.getMethod().getDeclaringType().hasQualifiedName("java.io", "File")
7875
)
7976
or
80-
/*
81-
* Look for the pattern `Paths.get(file.get*Path())` for converting between a `File` and a `Path`.
82-
*/
83-
77+
// Look for the pattern `Paths.get(file.get*Path())` for converting between a `File` and a `Path`.
8478
exists(MethodAccess pathsGet, MethodAccess fileGetPath |
8579
pathsGet = pathExpr and
8680
pathsGet.getMethod().hasName("get") and
@@ -99,10 +93,7 @@ private VarAccess getFileForPathConversion(Expr pathExpr) {
9993
* Holds if `fileAccess` is used in the `setWorldWritableExpr` to set the file to be world writable.
10094
*/
10195
private predicate fileSetWorldWritable(VarAccess fileAccess, Expr setWorldWritable) {
102-
/*
103-
* Calls to `File.setWritable(.., false)`.
104-
*/
105-
96+
// Calls to `File.setWritable(.., false)`.
10697
exists(MethodAccess fileSetWritable |
10798
// A call to the `setWritable` method.
10899
fileSetWritable.getMethod() instanceof SetWritable and
@@ -114,10 +105,7 @@ private predicate fileSetWorldWritable(VarAccess fileAccess, Expr setWorldWritab
114105
fileAccess = fileSetWritable.getQualifier()
115106
)
116107
or
117-
/*
118-
* Calls to `Files.setPosixFilePermissions(...)`.
119-
*/
120-
108+
// Calls to `Files.setPosixFilePermissions(...)`.
121109
exists(MethodAccess setPosixPerms |
122110
setPosixPerms = setWorldWritable and
123111
setPosixPerms.getMethod().hasName("setPosixFilePermissions") and
@@ -132,10 +120,7 @@ private predicate fileSetWorldWritable(VarAccess fileAccess, Expr setWorldWritab
132120
getAContainedEnumConstant(setPosixPerms.getArgument(1)).hasName("OTHERS_WRITE")
133121
)
134122
or
135-
/*
136-
* Calls to something that indirectly sets the file permissions.
137-
*/
138-
123+
// Calls to something that indirectly sets the file permissions.
139124
exists(Call call, int parameterPos, VarAccess nestedFileAccess, Expr nestedSetWorldWritable |
140125
call = setWorldWritable and
141126
fileSetWorldWritable(nestedFileAccess, nestedSetWorldWritable) and

0 commit comments

Comments
 (0)