summaryrefslogtreecommitdiffhomepage
path: root/tunnel/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-05-07 10:22:41 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2021-05-07 10:25:10 +0200
commit6acc1125b88e3ab9274b15722a0728a66bb3f16b (patch)
treedd6d21d3a7e5bc00ae83a59e56ee23f2ee687d82 /tunnel/src
parent94ecb13d2fd9f36a10b0209b2ddf161b4cc0a07f (diff)
tunnel: download hash list in chunks if necessary
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'tunnel/src')
-rw-r--r--tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java b/tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java
index e6605057..d1ad9e16 100644
--- a/tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java
+++ b/tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java
@@ -94,7 +94,11 @@ public class ModuleLoader {
final byte[] input = new byte[1024 * 1024 * 3 /* 3MiB */];
int len;
try (final InputStream inputStream = connection.getInputStream()) {
- len = inputStream.read(input);
+ int offset = 0;
+ while (input.length - offset > 0 && (len = inputStream.read(input, offset, input.length - offset)) > 0) {
+ offset += len;
+ }
+ len = offset;
}
if (len <= 0)
throw new IOException("Hash list was empty");