From 19858453d73bf6fb38eedac96e82a23f2d3632e5 Mon Sep 17 00:00:00 2001 From: nnao45 Date: Wed, 8 Nov 2017 00:06:00 +0900 Subject: packet/bgp: fix flowspec parser about cmd badly args --- packet/bgp/bgp.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'packet/bgp/bgp.go') diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go index 380cbbb2..21dc892d 100644 --- a/packet/bgp/bgp.go +++ b/packet/bgp/bgp.go @@ -3014,6 +3014,10 @@ func parseDecValuesCmd(myCmd string, validationFunc func(int) error) ([][2]int, return nil, err } case DECLogicOpNameMap[DEC_LOGIC_OP_AND], DECLogicOpNameMap[DEC_LOGIC_OP_OR]: + if index == 0 { + err := fmt.Errorf("Logic operator appears a first character") + return nil, err + } bit := DECLogicOpValueMap[myCmdChar] decOperatorsAndValues = append(decOperatorsAndValues, operatorValue) if myCmdChar == DECLogicOpNameMap[DEC_LOGIC_OP_AND] { -- cgit v1.2.3