From 05ab3c9ed13ed12958e29aec7f8ff00fbad5da4b Mon Sep 17 00:00:00 2001 From: Sundog Date: Fri, 23 Apr 2021 12:20:17 -0700 Subject: [PATCH] fix slice index underrun --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 0903eb8..7bb2305 100644 --- a/main.go +++ b/main.go @@ -194,8 +194,8 @@ func menuHandler(ctx context.Context, conn net.Conn, w *gaio.Watcher) { } if res.Operation == gaio.OpRead && res.Size > 0 && res.Conn == conn { log.Printf("received on inChan: conn: %v, buffer size: %v\n", res.Conn.RemoteAddr(), res.Size) - log.Println("menu receive: ", strings.TrimSpace(string(res.Buffer[:res.Size-2]))) - switch string(strings.TrimSpace(string(res.Buffer[:res.Size-2]))) { + log.Println("menu receive: ", strings.TrimSpace(string(res.Buffer[:res.Size-1]))) + switch string(strings.TrimSpace(string(res.Buffer[:res.Size-1]))) { case "welcome": welcomeStr, err := screenHandler("welcome", nil)