From 4f69c676b0da0b156cd0bf6255f39e704a2931cf Mon Sep 17 00:00:00 2001 From: siddharth Date: Sun, 10 Oct 2021 09:44:17 -0400 Subject: lib: update HexStrToAsciiStr Convert uint16 to byte before converting it to a string. --- lib/hex.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/hex.go b/lib/hex.go index f07ba08..ff5ee27 100644 --- a/lib/hex.go +++ b/lib/hex.go @@ -34,11 +34,11 @@ func HexStrToAsciiStr(h string) string { return a } if lh == 1 { - return string(HexCharToDec(h[0])) + return string(byte(HexCharToDec(h[0]))) } for i := 0; i < lh; i += 2 { - b := HexCharToDec(h[i])<<4 | HexCharToDec(h[i+1]) + b := byte(HexCharToDec(h[i])<<4 | HexCharToDec(h[i+1])) a += string(b) } return a -- cgit v1.2.3