From 01fdb1115d34aacc1033867bdf94c1b0b5317f39 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Sun, 3 Mar 2013 18:50:13 -0800 Subject: [PATCH] We don't support unknown content lengths yet. --- src/org/thoughtcrime/securesms/mms/MmsCommunication.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/org/thoughtcrime/securesms/mms/MmsCommunication.java b/src/org/thoughtcrime/securesms/mms/MmsCommunication.java index f1a35e18c6..da0076cb0d 100644 --- a/src/org/thoughtcrime/securesms/mms/MmsCommunication.java +++ b/src/org/thoughtcrime/securesms/mms/MmsCommunication.java @@ -157,6 +157,9 @@ public class MmsCommunication { if (entity == null || entity.getContentLength() == 0) throw new IOException("Null response"); + if (entity.getContentLength() < 0) + throw new IOException("Unknown content length!"); + byte[] responseBytes = new byte[(int)entity.getContentLength()]; DataInputStream dataInputStream = new DataInputStream(entity.getContent()); dataInputStream.readFully(responseBytes);