fix: buffer the bytes incase its less than 4

This commit is contained in:
Derrick Hammer 2024-01-03 07:17:37 -05:00
parent 50dd9251c2
commit 977b764904
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 1 deletions

View File

@ -9,5 +9,8 @@ func EncodeEndian(value uint32, length int) []byte {
} }
func DecodeEndian(byteSlice []byte) uint32 { func DecodeEndian(byteSlice []byte) uint32 {
return binary.LittleEndian.Uint32(byteSlice) buffer := make([]byte, 4)
copy(buffer, byteSlice)
return binary.LittleEndian.Uint32(buffer)
} }