summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2016-04-29 11:03:57 +0300
committerArne Schwabe <arne@rfc2549.org>2016-04-29 11:03:57 +0300
commit29a654d63189c96bdd5a3b0186f6bda0c4dcb399 (patch)
treef094f67e8b9250e873e22536617af95c3dfc6bdb /main/src
parent8c91cc5bb404b30ea066b9c0f646ee1a12d310a0 (diff)
Fix another crash reading broken logs.
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java4
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/LogItem.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java b/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java
index 7bb9d134..43a3f30e 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java
@@ -18,6 +18,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
+import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.util.Locale;
@@ -63,7 +64,7 @@ class LogFileHandler extends Handler {
flushToDisk();
}
- } catch (IOException e) {
+ } catch (IOException| BufferOverflowException e) {
e.printStackTrace();
VpnStatus.logError("Error during log cache: " + msg.what);
VpnStatus.logException(e);
@@ -88,6 +89,7 @@ class LogFileHandler extends Handler {
// We do not really care if the log cache breaks between Android upgrades,
// write binary format to disc
+
byte[] liBytes = li.getMarschaledBytes();
writeEscapedBytes(liBytes);
diff --git a/main/src/main/java/de/blinkt/openvpn/core/LogItem.java b/main/src/main/java/de/blinkt/openvpn/core/LogItem.java
index d767e073..ebe884a8 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/LogItem.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/LogItem.java
@@ -18,6 +18,7 @@ import android.util.Log;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
+import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -89,7 +90,7 @@ public class LogItem implements Parcelable {
}
- public byte[] getMarschaledBytes() throws UnsupportedEncodingException {
+ public byte[] getMarschaledBytes() throws UnsupportedEncodingException, BufferOverflowException {
ByteBuffer bb = ByteBuffer.allocate(16384);