From cab94360ec2cbc6efe59b755cd2c834902fad869 Mon Sep 17 00:00:00 2001 From: akwizgran <akwizgran@users.sourceforge.net> Date: Mon, 29 Feb 2016 15:47:56 +0000 Subject: [PATCH] Skip message header when parsing body. --- .../src/org/briarproject/clients/ClientHelperImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/briar-core/src/org/briarproject/clients/ClientHelperImpl.java b/briar-core/src/org/briarproject/clients/ClientHelperImpl.java index 361b631898..9826dc4342 100644 --- a/briar-core/src/org/briarproject/clients/ClientHelperImpl.java +++ b/briar-core/src/org/briarproject/clients/ClientHelperImpl.java @@ -29,6 +29,8 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; +import static org.briarproject.api.sync.SyncConstants.MESSAGE_HEADER_LENGTH; + class ClientHelperImpl implements ClientHelper { private final DatabaseComponent db; @@ -104,7 +106,8 @@ class ClientHelperImpl implements ClientHelper { throws DbException, FormatException { byte[] raw = db.getRawMessage(txn, m); if (raw == null) return null; - ByteArrayInputStream in = new ByteArrayInputStream(raw); + ByteArrayInputStream in = new ByteArrayInputStream(raw, + MESSAGE_HEADER_LENGTH, raw.length - MESSAGE_HEADER_LENGTH); BdfReader reader = bdfReaderFactory.createReader(in); BdfDictionary dictionary; try { @@ -138,7 +141,8 @@ class ClientHelperImpl implements ClientHelper { throws DbException, FormatException { byte[] raw = db.getRawMessage(txn, m); if (raw == null) return null; - ByteArrayInputStream in = new ByteArrayInputStream(raw); + ByteArrayInputStream in = new ByteArrayInputStream(raw, + MESSAGE_HEADER_LENGTH, raw.length - MESSAGE_HEADER_LENGTH); BdfReader reader = bdfReaderFactory.createReader(in); BdfList list; try { -- GitLab