From 3c3bf5038bee6fce149aae0d977bb4d4e1e2073c Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 12 Feb 2025 16:14:16 +0800 Subject: router.go: Fix out-of-bounds read on /: --- router.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'router.go') diff --git a/router.go b/router.go index 5a77131..c843698 100644 --- a/router.go +++ b/router.go @@ -16,6 +16,11 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } + if len(segments) < 2 { + http.Error(w, "Blank system endpoint", http.StatusNotFound) + return + } + if segments[0] == ":" { switch segments[1] { case "static": -- cgit v1.2.3