summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2015-08-06 15:36:33 +0200
committerArne Schwabe <arne@rfc2549.org>2015-08-06 15:36:33 +0200
commite6af88b346e9eb5be462429bf9786e7e89ce0e0d (patch)
treea6b5c7ca8f3a988ef6e7efb6e361e5f2e610a5ee
parent26d66a9b4659082efeb4b99224d22120a8f4632d (diff)
Don't try to embed arbitrary big files.
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/Utils.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java b/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java
index 606ea5f2..d3c2bdcb 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java
@@ -199,8 +199,12 @@ public class Utils {
int nRead;
byte[] data = new byte[16384];
- while ((nRead = input.read(data, 0, data.length)) != -1) {
+ ;
+
+ long totalread = 0;
+ while ((nRead = input.read(data, 0, data.length)) != -1 && totalread <VpnProfile.MAX_EMBED_FILE_SIZE ) {
buffer.write(data, 0, nRead);
+ totalread+=nRead;
}
buffer.flush();