From a061300d59fefdb2cbac25d3ee1658fecc3d1cbf 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. --- 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