From b5eff27c4069cdee7733d58207a8bbef69948b26 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Mon, 7 Apr 2025 21:39:46 +0900 Subject: [PATCH] fortify: check fst id string length This should never be a problem, however in case it happens printing a warning message is better than relying on the runtime to panic. Signed-off-by: Ophestra --- print.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/print.go b/print.go index 7af1a22..923bd04 100644 --- a/print.go +++ b/print.go @@ -256,6 +256,12 @@ func printPs(output io.Writer, now time.Time, s state.Store, short, flagJSON boo t.Println("\tInstance\tPID\tApplication\tUptime") for _, e := range exp { + if len(e.s) != 1<<5 { + // unreachable + log.Printf("possible store corruption: invalid instance string %s", e.s) + continue + } + as := "(No configuration information)" if e.Config != nil { as = strconv.Itoa(e.Config.Confinement.AppID)