From e876eacc75f8b384d4bf4691a065dd24946ae881 Mon Sep 17 00:00:00 2001 From: Mr Forest Date: Mon, 26 Sep 2022 14:45:53 +0800 Subject: [PATCH] Update packet.go --- packet.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packet.go b/packet.go index 3f9a1b8..ebbc9fd 100644 --- a/packet.go +++ b/packet.go @@ -86,7 +86,8 @@ func readTagAndLength(conn *bufio.Reader, bytes *[]byte) (ret ldap.TagAndLength, // } // We are expecting the LDAP sequence tag 0x30 as first byte if b != 0x30 { - panic(fmt.Sprintf("Expecting 0x30 as first byte, but got %#x instead", b)) + err = ldap.SyntaxError{fmt.Sprintf("expecting 0x30 as first byte, but got %#x instead", b)} + return } b, err = readBytes(conn, bytes, 1)