@@ -225,24 +225,54 @@ def convert_cve_version(version):
return version + update
-def decode_cve_status(d, cve):
+def decode_cve_status_scoped(d, cve):
"""
- Convert CVE_STATUS into status, detail and description.
+ Convert CVE_STATUS into status, vendor, product, detail and description.
"""
status = d.getVarFlag("CVE_STATUS", cve)
if not status:
- return ("", "", "")
+ return {}
+
+ status_split = status.split(':', 5)
+ status_out = {}
+ status_out["detail"] = status_split[0]
+ product = "*"
+ vendor = "*"
+ description = ""
+ if len(status_split) >= 4 and status_split[1].strip() == "cpe":
+ # Both vendor and product are mandatory if cpe: present, the syntax is then:
+ # detail: cpe:vendor:product:description
+ vendor = status_split[2].strip()
+ product = status_split[3].strip()
+ description = status_split[4].strip()
+ elif len(status_split) >= 2 and status_split[1].strip() == "cpe":
+ # Malformed CPE
+ bb.warn('Invalid CPE information for CVE_STATUS[%s] = "%s", not setting CPE' % (detail, cve, status))
+ else:
+ # Other case: no CPE, the syntax is then:
+ # detail: description
+ description = status_split[len(status_split)-1].strip() if (len(status_split) > 1) else ""
- status_split = status.split(':', 1)
- detail = status_split[0]
- description = status_split[1].strip() if (len(status_split) > 1) else ""
+ status_out["vendor"] = vendor
+ status_out["product"] = product
+ status_out["description"] = description
- status_mapping = d.getVarFlag("CVE_CHECK_STATUSMAP", detail)
+ status_mapping = d.getVarFlag("CVE_CHECK_STATUSMAP", status_out['detail'])
if status_mapping is None:
bb.warn('Invalid detail "%s" for CVE_STATUS[%s] = "%s", fallback to Unpatched' % (detail, cve, status))
status_mapping = "Unpatched"
+ status_out["mapping"] = status_mapping
+
+ return status_out
- return (status_mapping, detail, description)
+def decode_cve_status(d, cve):
+ """
+ Convert CVE_STATUS into status, detail and description.
+ """
+ status = decode_cve_status_scoped(d, cve)
+ if not status:
+ return ("", "", "")
+ return (status["mapping"], status["detail"], status["description"])
def extend_cve_status(d):
# do this only once in case multiple classes use this