From da0b1a6f1dbb7373901d7a7b8179fafc134caca3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Debora=20W=C3=B6pcke?= Date: Sat, 6 Jun 2015 21:06:54 +0200 Subject: [PATCH] Avoid one case of getting out of synch and trying to read too much. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: David ‘Bombe’ Roden --- src/main/java/net/pterodactylus/fcp/FcpUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/fcp/FcpUtils.java b/src/main/java/net/pterodactylus/fcp/FcpUtils.java index 415cf1a..26a407c 100644 --- a/src/main/java/net/pterodactylus/fcp/FcpUtils.java +++ b/src/main/java/net/pterodactylus/fcp/FcpUtils.java @@ -268,7 +268,9 @@ public class FcpUtils { throw new EOFException("stream reached eof"); } destination.write(buffer, 0, read); - remaining -= read; + if (remaining > 0) { + remaining -= read; + } } } -- 2.7.4