From cd92bf4385047e7957019767af0caafd2b885221 Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Sun, 31 May 2015 04:34:21 +0200 Subject: [PATCH] Adds panic when using too many handlers --- routergroup.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/routergroup.go b/routergroup.go index 8afd29e..74dc82f 100644 --- a/routergroup.go +++ b/routergroup.go @@ -148,6 +148,9 @@ func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileS func (group *RouterGroup) combineHandlers(handlers HandlersChain) HandlersChain { finalSize := len(group.Handlers) + len(handlers) + if finalSize >= AbortIndex { + panic("too many handlers") + } mergedHandlers := make(HandlersChain, finalSize) copy(mergedHandlers, group.Handlers) copy(mergedHandlers[len(group.Handlers):], handlers)