diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java index d3264d5f2..01d92770b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java @@ -113,7 +113,12 @@ class PacketLineIn { if (len == 0) return ""; - final byte[] raw = new byte[len]; + byte[] raw; + if (len <= lineBuffer.length) + raw = lineBuffer; + else + raw = new byte[len]; + IO.readFully(in, raw, 0, len); if (raw[len - 1] == '\n') len--;