diff options
author | Konrad Weihmann <kweihmann@outlook.com> | 2021-04-22 18:48:27 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-05-04 22:57:55 +0100 |
commit | 1ee02f662cfd4891dccf50b3a429a75940c97140 (patch) | |
tree | 1d6947d93b12af2a553a1e16bc4bbca45e01e51e /meta/recipes-core/meta | |
parent | 79998ab952c4e4d3c311ed85e6e5e126f537802c (diff) | |
download | poky-1ee02f662cfd4891dccf50b3a429a75940c97140.tar.gz |
cve-update-db-native: skip on empty cpe23Uri
Recently an entry in the NVD DB appeared that looks like that
{'vulnerable': True, 'cpe_name': []}.
As besides all the vulnerable flag no data is present we would get
a KeyError exception on acccess.
Use get method on dictionary and return if no meta data is present
Also quit if the length of the array after splitting is less than 6
(From OE-Core rev: 45148918628ba797755f3cbb52f065ec6dbbcfd2)
Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 00ce2796d97de2bc376b038d0ea7969088791d34)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/meta')
-rw-r--r-- | meta/recipes-core/meta/cve-update-db-native.bb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/meta/recipes-core/meta/cve-update-db-native.bb b/meta/recipes-core/meta/cve-update-db-native.bb index 5d9fb59cbc..e86c69803f 100644 --- a/meta/recipes-core/meta/cve-update-db-native.bb +++ b/meta/recipes-core/meta/cve-update-db-native.bb | |||
@@ -132,7 +132,12 @@ def parse_node_and_insert(c, node, cveId): | |||
132 | for cpe in node.get('cpe_match', ()): | 132 | for cpe in node.get('cpe_match', ()): |
133 | if not cpe['vulnerable']: | 133 | if not cpe['vulnerable']: |
134 | return | 134 | return |
135 | cpe23 = cpe['cpe23Uri'].split(':') | 135 | cpe23 = cpe.get('cpe23Uri') |
136 | if not cpe23: | ||
137 | return | ||
138 | cpe23 = cpe23.split(':') | ||
139 | if len(cpe23) < 6: | ||
140 | return | ||
136 | vendor = cpe23[3] | 141 | vendor = cpe23[3] |
137 | product = cpe23[4] | 142 | product = cpe23[4] |
138 | version = cpe23[5] | 143 | version = cpe23[5] |