From 1a600194b161e270d3daa52ae3781fe9ef885cf9 Mon Sep 17 00:00:00 2001 From: Owen Cabalceta Date: Mon, 29 Jul 2024 11:47:09 -0400 Subject: [PATCH] patch: empty names field causes mockt181's GET to panic - empty names field causes mockt181's GET to panic (`name[len(name)-1] == '.'`) --- internal/wrphandlers/mocktr181/handler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/wrphandlers/mocktr181/handler.go b/internal/wrphandlers/mocktr181/handler.go index fff6f67..f33782c 100644 --- a/internal/wrphandlers/mocktr181/handler.go +++ b/internal/wrphandlers/mocktr181/handler.go @@ -173,6 +173,10 @@ func (h Handler) get(tr181 *Tr181Payload) (int64, []byte, error) { for _, name := range tr181.Names { var found bool for _, mockParameter := range h.parameters { + if name == "" { + continue + } + if !strings.HasPrefix(mockParameter.Name, name) { continue }