volley: add array length check to streamToBytes.

refactor-toolbar
Floens 8 years ago
parent 9def461f4a
commit 16ef48f65b
  1. 4
      Clover/app/src/main/java/com/android/volley/toolbox/DiskBasedCache.java

@ -322,6 +322,10 @@ public class DiskBasedCache implements Cache {
* Reads the contents of an InputStream into a byte[]. * Reads the contents of an InputStream into a byte[].
* */ * */
private static byte[] streamToBytes(InputStream in, int length) throws IOException { private static byte[] streamToBytes(InputStream in, int length) throws IOException {
if (length < 0) {
throw new IOException("length < 0");
}
byte[] bytes = new byte[length]; byte[] bytes = new byte[length];
int count; int count;
int pos = 0; int pos = 0;

Loading…
Cancel
Save