From 27f662958be70cf3e72c9d5d8643fd22135bca25 Mon Sep 17 00:00:00 2001 From: zhuanlan Date: Wed, 20 Mar 2024 13:59:05 +0800 Subject: [PATCH] controller security_group: Fix index out of range problem Signed-off-by: zhuanlan --- pkg/controller/security_group.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/controller/security_group.go b/pkg/controller/security_group.go index a7b1f3cac80..2ffd15b755c 100644 --- a/pkg/controller/security_group.go +++ b/pkg/controller/security_group.go @@ -194,7 +194,7 @@ func (c *Controller) updateDenyAllSgPorts() error { addPorts := make([]string, 0, len(lsps)) for _, lsp := range lsps { // skip lsp which only have mac addresses,address is in port.PortSecurity[0] - if len(strings.Split(lsp.PortSecurity[0], " ")) < 2 { + if len(lsp.PortSecurity) == 0 || len(strings.Split(lsp.PortSecurity[0], " ")) < 2 { continue }