Skip to content

Commit 874d9d1

Browse files
authored
Merge pull request #16290 from aschackmull/java/oscheck-perf
Java: Fix join-order.
2 parents bcedf68 + c45fd40 commit 874d9d1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

java/ql/lib/semmle/code/java/os/OSCheck.qll

+7-1
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,17 @@ abstract class IsUnixGuard extends Guard { }
3737
*/
3838
abstract class IsSpecificUnixVariant extends Guard { }
3939

40+
private DataFlow::Node osNameFlow() {
41+
result.asExpr() = getSystemProperty("os.name")
42+
or
43+
TaintTracking::localTaintStep(osNameFlow(), result)
44+
}
45+
4046
/**
4147
* Holds when `ma` compares the current OS against the string constant `osString`.
4248
*/
4349
private predicate isOsFromSystemProp(MethodCall ma, string osString) {
44-
TaintTracking::localExprTaint(getSystemProperty("os.name"), ma.getQualifier()) and // Call from System.getProperty (or equivalent) to some partial match method
50+
osNameFlow().asExpr() = ma.getQualifier() and // Call from System.getProperty (or equivalent) to some partial match method
4551
exists(StringPartialMatchMethod m, CompileTimeConstantExpr matchedStringConstant |
4652
m = ma.getMethod() and
4753
matchedStringConstant.getStringValue().toLowerCase() = osString

0 commit comments

Comments
 (0)