Skip to content

Commit 9d6a10b

Browse files
Jami CogswellJami Cogswell
Jami Cogswell
authored and
Jami Cogswell
committed
Java: rename 'isSingleReplaceAll' and 'isDoubleReplaceOrReplaceAll'
1 parent 41aeb87 commit 9d6a10b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

java/ql/lib/semmle/code/java/security/PathSanitizer.qll

+8-4
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,9 @@ private predicate isReplaceTarget(StringReplaceCall replaceCall, CompileTimeCons
414414
}
415415

416416
/** Holds if a single `replaceAllCall` replaces all directory characters. */
417-
private predicate isSingleReplaceAll(StringReplaceAllCall replaceAllCall) {
417+
private predicate replacesDirectoryCharactersWithSingleReplaceAll(
418+
StringReplaceAllCall replaceAllCall
419+
) {
418420
exists(CompileTimeConstantExpr target, string targetValue |
419421
isReplaceAllTarget(replaceAllCall, target) and
420422
target.getStringValue() = targetValue
@@ -436,7 +438,9 @@ private predicate isSingleReplaceAll(StringReplaceAllCall replaceAllCall) {
436438
* Holds if there are two chained replacement calls, `rc1` and `rc2`, that replace
437439
* '.' and one of '/' or '\'.
438440
*/
439-
private predicate isDoubleReplaceOrReplaceAll(StringReplaceOrReplaceAllCall rc1) {
441+
private predicate replacesDirectoryCharactersWithDoubleReplaceOrReplaceAll(
442+
StringReplaceOrReplaceAllCall rc1
443+
) {
440444
exists(
441445
CompileTimeConstantExpr target1, string targetValue1, StringReplaceOrReplaceAllCall rc2,
442446
CompileTimeConstantExpr target2, string targetValue2
@@ -471,8 +475,8 @@ private predicate isDoubleReplaceOrReplaceAll(StringReplaceOrReplaceAllCall rc1)
471475
*/
472476
private class ReplaceDirectoryCharactersSanitizer extends StringReplaceOrReplaceAllCall {
473477
ReplaceDirectoryCharactersSanitizer() {
474-
isSingleReplaceAll(this) or
475-
isDoubleReplaceOrReplaceAll(this)
478+
replacesDirectoryCharactersWithSingleReplaceAll(this) or
479+
replacesDirectoryCharactersWithDoubleReplaceOrReplaceAll(this)
476480
}
477481
}
478482

0 commit comments

Comments
 (0)