From edac08842d4af17a24e53aacde680e7e741f03c8 Mon Sep 17 00:00:00 2001 From: Pea Nut <peanut2@systemli.org> Date: Fri, 20 Sep 2024 11:47:43 +0200 Subject: [PATCH] [management] Improve error handling in *StateEvent.parts() Create slice with a length of 6 when receiving an invalid management message. This position holds the connected port. --- pkg/vpn/management/event.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/vpn/management/event.go b/pkg/vpn/management/event.go index cc9cf80c..c9e0267a 100644 --- a/pkg/vpn/management/event.go +++ b/pkg/vpn/management/event.go @@ -173,8 +173,8 @@ func (e *StateEvent) parts() [][]byte { // Prevent crash if the server has sent us a malformed // status message. This should never actually happen if // the server is behaving itself. - if len(e.bodyParts) < 5 { - expanded := make([][]byte, 5) + if len(e.bodyParts) < 6 { + expanded := make([][]byte, 6) copy(expanded, e.bodyParts) e.bodyParts = expanded } -- GitLab