Fixed length bug in putString (Fixes #187)

This commit is contained in:
Jeroen van Erp
2017-12-27 23:02:41 +01:00
parent 5e1be8b1b0
commit 8ca6451d5d
2 changed files with 2 additions and 4 deletions

View File

@@ -246,7 +246,7 @@ public class Buffer<T extends Buffer<T>> {
* @return this * @return this
*/ */
public T putBytes(byte[] b, int off, int len) { public T putBytes(byte[] b, int off, int len) {
return putUInt32(len - off).putRawBytes(b, off, len); return putUInt32(len).putRawBytes(b, off, len);
} }
public void readRawBytes(byte[] buf) public void readRawBytes(byte[] buf)

View File

@@ -82,9 +82,7 @@ public class RemoteFile
throws IOException { throws IOException {
return requester.request(newRequest(PacketType.WRITE) return requester.request(newRequest(PacketType.WRITE)
.putUInt64(fileOffset) .putUInt64(fileOffset)
// TODO The SFTP spec claims this field is unneeded...? See #187 .putString(data, off, len)
.putUInt32(len)
.putRawBytes(data, off, len)
); );
} }