Skip to content

Commit e70bf33

Browse files
committed
fix: update opkg parser
Update opkg version pattern to handle prpl packages (openWRT flavor) Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent b8fcf3b commit e70bf33

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cve_bin_tool/parsers/opkg.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ def run_checker(self, filename):
3939
if cpe_id is None:
4040
self.logger.debug(f"{filename} doesn't contain any CPE-ID")
4141
return
42-
# version is always suffixed by a digit (e.g. 2.90-1 instead of 2.90)
42+
# version is always suffixed (e.g. 2.90-r1 instead of 2.90)
43+
# it can sometimes be prefixed (e.g. gen_2.90_v0.2.3-r1)
4344
version = search(
44-
compile(r"^Version: (.+)-([0-9\.]+)$", MULTILINE), lines
45+
compile(r"^Version: [a-z_]*([0-9_\-\.]+)[-_]+", MULTILINE), lines
4546
).group(1)
4647
vendor, product, _ = decode_cpe22(f"{cpe_id.group(1)}:{version}")
4748
vendorlist: list[ScanInfo] = [

0 commit comments

Comments
 (0)