From f91631640843e1dd48a3ce13bb7b06e73a16429b Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Thu, 3 Aug 2023 16:40:37 +0800 Subject: [PATCH] fix: update code Signed-off-by: Junjie Gao --- internal/encoding/asn1/asn1.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/encoding/asn1/asn1.go b/internal/encoding/asn1/asn1.go index 5dd6fd7e..f098d191 100644 --- a/internal/encoding/asn1/asn1.go +++ b/internal/encoding/asn1/asn1.go @@ -68,7 +68,7 @@ func decode(r []byte) (value, error) { } // primitive value - if isPrimitive(identifier[0]) { + if isPrimitive(identifier) { if contentLen != len(r) { return nil, ErrBytesAtTheEnd } @@ -110,7 +110,7 @@ func decode(r []byte) (value, error) { if err != nil { return nil, err } - if isPrimitive(identifier[0]) { + if isPrimitive(identifier) { // primitive value pv := primitiveValue{ identifier: identifier, @@ -230,6 +230,6 @@ func decodeLength(r []byte) (int, []byte, error) { // isPrimitive returns true if the first identifier octet is marked // as primitive. -func isPrimitive(b byte) bool { - return b&0x20 == 0 +func isPrimitive(identifier []byte) bool { + return identifier[0]&0x20 == 0 }