]> code.ossystems Code Review - openembedded-core.git/commitdiff
cve-update-db-native: consider version suffix when update CVE db
authorLee Chee Yang <chee.yang.lee@intel.com>
Thu, 4 Mar 2021 14:44:06 +0000 (22:44 +0800)
committerSteve Sakoman <steve@sakoman.com>
Wed, 24 Mar 2021 14:30:32 +0000 (04:30 -1000)
some record from NVD can merge or split suffix from version, for
example:
  CVE-2017-15906
  "cpe23Uri" : "cpe:2.3:a:openbsd:openssh:5.0:p1:*:*:*:*:*:*"
  "cpe23Uri" : "cpe:2.3:a:openbsd:openssh:4.7p1:*:*:*:*:*:*:*"

in such case include the suffix into version when update local CVE db.

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 13cc68197f81bb7c76fa1abecc5dd720b8bdb8d5)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/recipes-core/meta/cve-update-db-native.bb

index 9e8e006a32c510a4259bcb5bcef36b9417448d70..5d9fb59cbcba8d6fa39aada779bdea90eab704a8 100644 (file)
@@ -137,9 +137,14 @@ def parse_node_and_insert(c, node, cveId):
             product = cpe23[4]
             version = cpe23[5]
 
+            if cpe23[6] == '*' or cpe23[6] == '-':
+                version_suffix = ""
+            else:
+                version_suffix = "_" + cpe23[6]
+
             if version != '*' and version != '-':
                 # Version is defined, this is a '=' match
-                yield [cveId, vendor, product, version, '=', '', '']
+                yield [cveId, vendor, product, version + version_suffix, '=', '', '']
             elif version == '-':
                 # no version information is available
                 yield [cveId, vendor, product, version, '', '', '']