Skip to content

Commit 7a9381f

Browse files
authored
Add declaring type to the res.getString(R.string.key) call
1 parent 819a599 commit 7a9381f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

java/ql/src/experimental/CWE-939/IncorrectURLVerification.ql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ class HostVerificationMethodAccess extends MethodAccess {
6363
.getRepresentedString()
6464
.charAt(0) != "." //"."+var2, check string constant "." e.g. String domainName = "example.com"; Uri.parse(url).getHost().endsWith("www."+domainName)
6565
or
66-
exists(MethodAccess ma |
66+
exists(MethodAccess ma, Method m |
6767
this.getArgument(0) = ma and
68-
ma.getMethod().hasName("getString") and
68+
ma.getMethod() = m and
69+
m.hasName("getString") and
70+
m.getDeclaringType().getQualifiedName() = "android.content.res.Resources" and
6971
ma.getArgument(0).toString().indexOf("R.string") = 0
7072
) //Check resource properties in /res/values/strings.xml in Android mobile applications using res.getString(R.string.key)
7173
or

0 commit comments

Comments
 (0)