From 9549cd396c408c11f7d5cb6e4286dc8e7d9c6419 Mon Sep 17 00:00:00 2001 From: Kota Kanbe Date: Fri, 16 Nov 2018 20:38:01 +0900 Subject: [PATCH] fix(cpe): fix cpe match false positive (#113) --- db/db.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/db/db.go b/db/db.go index 9da97300..f4ea764c 100644 --- a/db/db.go +++ b/db/db.go @@ -105,6 +105,13 @@ func match(specified common.WellFormedName, cpe models.Cpe) (bool, error) { if err != nil { return false, err } + + if wfn.Get("part") != specified.Get("part") || + wfn.Get("vendor") != specified.Get("vendor") || + wfn.Get("product") != specified.Get("product") { + return false, nil + } + if matching.IsEqual(specified, wfn) { log.Debugf("%s equals %s", specified.String(), cpe.URI) return true, nil