From 15fef789337a81b725d00f871e283a68e5724746 Mon Sep 17 00:00:00 2001 From: Ramana Reddy Date: Fri, 16 Feb 2024 21:54:18 +0530 Subject: [PATCH] Fix filling cve-ids on empty stdin --- pkg/runner/runner.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go index bcbea96..d936d17 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -184,7 +184,10 @@ func ParseOptions() *Options { if err != nil { gologger.Fatal().Msgf("couldn't read stdin: %s\n", err) } - options.CveIds = append(options.CveIds, strings.Split(strings.TrimSpace(string(bin)), "\n")...) + stdinStr := strings.TrimSpace(string(bin)) + if stdinStr != "" { + options.CveIds = append(options.CveIds, strings.Split(stdinStr, "\n")...) + } } // convert cve-ids and cwe-ids to uppercase