mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
Don't consider copyOf() and clone() in ArrayUpdate
This commit is contained in:
@@ -50,12 +50,6 @@ private class ArrayUpdate extends Expr {
|
||||
ma.getArgument(2) = array
|
||||
)
|
||||
or
|
||||
exists(StaticMethodAccess ma |
|
||||
ma.getMethod().hasQualifiedName("java.util", "Arrays", ["copyOf", "copyOfRange"]) and
|
||||
ma = this and
|
||||
ma = array
|
||||
)
|
||||
or
|
||||
exists(MethodAccess ma, Method m |
|
||||
m = ma.getMethod() and
|
||||
ma = this and
|
||||
@@ -66,10 +60,6 @@ private class ArrayUpdate extends Expr {
|
||||
m.hasQualifiedName("java.security", "SecureRandom", "nextBytes") or
|
||||
m.hasQualifiedName("java.util", "Random", "nextBytes")
|
||||
)
|
||||
or
|
||||
exists(MethodAccess ma, Method m | m = ma.getMethod() |
|
||||
m.getDeclaringType().hasName("byte[]") and m.hasName("clone") and ma = this and ma = array
|
||||
)
|
||||
}
|
||||
|
||||
/** Returns the updated array. */
|
||||
|
||||
@@ -153,7 +153,8 @@ public class StaticInitializationVector {
|
||||
byte[] randomBytes = new byte[16];
|
||||
SecureRandom.getInstanceStrong().nextBytes(randomBytes);
|
||||
|
||||
byte[] iv = Arrays.copyOf(randomBytes, 16);
|
||||
byte[] iv = new byte[16];
|
||||
iv = Arrays.copyOf(randomBytes, 16);
|
||||
|
||||
GCMParameterSpec ivSpec = new GCMParameterSpec(128, iv);
|
||||
SecretKeySpec keySpec = new SecretKeySpec(key, "AES");
|
||||
|
||||
Reference in New Issue
Block a user