From cf864799cbc8cc21b1a40bd16437a9e8966d9d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Thu, 23 Dec 2021 23:04:13 +0800 Subject: [PATCH] fix: WriteIntLvPacket length error (#226) --- binary/writer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binary/writer.go b/binary/writer.go index 18d8a8e6..e993ca9d 100644 --- a/binary/writer.go +++ b/binary/writer.go @@ -100,9 +100,9 @@ func (w *Writer) EncryptAndWrite(key []byte, data []byte) { } func (w *Writer) WriteIntLvPacket(offset int, f func(*Writer)) { - w.FillUInt32() + pos := w.FillUInt32() f(w) - w.WriteUInt32At(0, uint32(w.Len()-4+offset)) + w.WriteUInt32At(pos, uint32(w.Len()+offset-pos-4)) } func (w *Writer) WriteBytesShort(data []byte) {