From 8e2fc3a4250ee15a138e9f698af7d3919b9fd7cc Mon Sep 17 00:00:00 2001 From: pingstar Date: Mon, 22 Mar 2021 22:29:41 +0800 Subject: [PATCH] Fix: the panic caused by parsing requestinfo slice access out of bounds Signed-off-by: pingstar --- pkg/apiserver/request/requestinfo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/apiserver/request/requestinfo.go b/pkg/apiserver/request/requestinfo.go index 77f3da048..5c937cade 100644 --- a/pkg/apiserver/request/requestinfo.go +++ b/pkg/apiserver/request/requestinfo.go @@ -181,7 +181,7 @@ func (r *RequestInfoFactory) NewRequestInfo(req *http.Request) (*RequestInfo, er requestInfo.APIVersion = currentParts[0] currentParts = currentParts[1:] - if specialVerbs.Has(currentParts[0]) { + if len(currentParts) > 0 && specialVerbs.Has(currentParts[0]) { if len(currentParts) < 2 { return &requestInfo, fmt.Errorf("unable to determine kind and namespace from url: %v", req.URL) }