aboutsummaryrefslogtreecommitdiff
path: root/router.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-12 16:14:16 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-12 16:14:16 +0800
commit3c3bf5038bee6fce149aae0d977bb4d4e1e2073c (patch)
treeb1acd28ca9524770f34e6406eeb8a9e1f48f3549 /router.go
parent*.go: Reformat (diff)
downloadforge-3c3bf5038bee6fce149aae0d977bb4d4e1e2073c.tar.gz
forge-3c3bf5038bee6fce149aae0d977bb4d4e1e2073c.tar.zst
forge-3c3bf5038bee6fce149aae0d977bb4d4e1e2073c.zip
router.go: Fix out-of-bounds read on /:
Diffstat (limited to 'router.go')
-rw-r--r--router.go5
1 files changed, 5 insertions, 0 deletions
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":