Skip to content

Commit fd92c4e

Browse files
Apply suggestions from code review
Co-authored-by: Anders Schack-Mulligen <[email protected]>
1 parent a5749a5 commit fd92c4e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ private class DefaultIntentRedirectionSink extends IntentRedirectionSink {
7171
*/
7272
private class DefaultIntentRedirectionSanitizer extends IntentRedirectionSanitizer {
7373
DefaultIntentRedirectionSanitizer() {
74-
exists(MethodAccess ma, Method m |
74+
exists(MethodAccess ma, Method m, Guard g, boolean branch |
7575
ma.getMethod() = m and
7676
m.getDeclaringType() instanceof TypeComponentName and
7777
m.hasName(["getPackageName", "getClassName"]) and
78-
ma.getBasicBlock().(ConditionBlock).controls(this.asExpr().getBasicBlock(), true)
78+
g.isEquality(ma, _, branch) and
79+
g.controls(this.asExpr().getBasicBlock(), branch)
7980
)
8081
}
8182
}

java/ql/src/Security/CWE/CWE-940/AndroidIntentRedirectionSample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
// GOOD: The component that sent the Intent is checked before launching the destination component
1414
Intent forwardIntent = (Intent) getIntent().getParcelableExtra("forward_intent");
1515
ComponentName originComponent = getCallingActivity();
16-
if (originComponent.getPackageName().equals("trusted.package") && originComponent.getClassName("TrustedClass")) {
16+
if (originComponent.getPackageName().equals("trusted.package") && originComponent.getClassName().equals("TrustedClass")) {
1717
startActivity(forwardIntent);
1818
}

0 commit comments

Comments
 (0)