From 977b76490419f02e313bf02bf33394ee61d81fc0 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 3 Jan 2024 07:17:37 -0500 Subject: [PATCH] fix: buffer the bytes incase its less than 4 --- utils/endian.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/endian.go b/utils/endian.go index d18fb3f..913a231 100644 --- a/utils/endian.go +++ b/utils/endian.go @@ -9,5 +9,8 @@ func EncodeEndian(value uint32, length int) []byte { } func DecodeEndian(byteSlice []byte) uint32 { - return binary.LittleEndian.Uint32(byteSlice) + buffer := make([]byte, 4) + copy(buffer, byteSlice) + + return binary.LittleEndian.Uint32(buffer) }