1 files changed, 4 insertions(+), 3 deletions(-)

M kgp.go
M kgp.go +4 -3
@@ 152,7 152,8 @@ func (packet *Packet) Type() int {
 }
 
 func (packet *Packet) Size() uint64 {
-	var size = binary.Size(&packet.header)
+	var x uint16
+	var size = binary.Size(&packet.header) + binary.Size(x)
 	if packet.Payload != nil {
 		size += len(packet.Payload)
 	}

          
@@ 170,7 171,7 @@ func (packet *Packet) ReadFrom(reader io
 	}
 	n += int64(binary.Size(&packet.header))
 
-	var payloadlen int16
+	var payloadlen uint16
 	if err = binary.Read(reader, binary.BigEndian, &payloadlen); err != nil {
 		return
 	}

          
@@ 195,7 196,7 @@ func (packet *Packet) WriteTo(w io.Write
 	}
 	n += int64(binary.Size(&packet.header))
 
-	var payloadlen = int16(len(packet.Payload))
+	var payloadlen = uint16(len(packet.Payload))
 	if err = binary.Write(w, binary.BigEndian, &payloadlen); err != nil {
 		return
 	}