From 65d094d7f25e7304832b104f429449cbcd22770d Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Wed, 24 Feb 2021 08:27:44 +0900 Subject: server: fix AdministrativeCommunication message parser Signed-off-by: FUJITA Tomonori --- pkg/server/util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg/server/util.go') diff --git a/pkg/server/util.go b/pkg/server/util.go index e4abbed0..474d495b 100644 --- a/pkg/server/util.go +++ b/pkg/server/util.go @@ -59,8 +59,8 @@ func decodeAdministrativeCommunication(data []byte) (string, []byte) { if communicationLen > bgp.BGP_ERROR_ADMINISTRATIVE_COMMUNICATION_MAX { communicationLen = bgp.BGP_ERROR_ADMINISTRATIVE_COMMUNICATION_MAX } - if communicationLen > len(data)+1 { - communicationLen = len(data) + 1 + if communicationLen > len(data)-1 { + communicationLen = len(data) - 1 } return string(data[1 : communicationLen+1]), data[communicationLen+1:] } -- cgit v1.2.3