Skip to content

Commit 8022a03

Browse files
committed
fix: update location handling
Do not use find_product_location to set the location field in version_scanner.py as otherwise cve-bin-tool will try to find the location of the product on the host system (which is obviously wrong). Instead, set the location to be the file_path Fix #4396 Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent 3029cb0 commit 8022a03

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

cve_bin_tool/version_scanner.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,7 @@
1717
from cve_bin_tool.log import LOGGER
1818
from cve_bin_tool.parsers.parse import available_parsers, parse, valid_files
1919
from cve_bin_tool.strings import parse_strings
20-
from cve_bin_tool.util import (
21-
DirWalk,
22-
ProductInfo,
23-
ScanInfo,
24-
find_product_location,
25-
inpath,
26-
validate_location,
27-
)
20+
from cve_bin_tool.util import DirWalk, ProductInfo, ScanInfo, inpath
2821

2922
if sys.version_info >= (3, 10):
3023
from importlib import metadata as importlib_metadata
@@ -288,15 +281,8 @@ def run_checkers(self, filename: str, lines: str) -> Iterator[ScanInfo]:
288281
f'{file_path} {result["is_or_contains"]} {dummy_checker_name} {version}'
289282
)
290283
for vendor, product in checker.VENDOR_PRODUCT:
291-
location = find_product_location(product)
292-
if location is None:
293-
location = "NotFound"
294-
if validate_location(location) is False:
295-
raise ValueError(
296-
f"Invalid location {location} for {product}"
297-
)
298284
yield ScanInfo(
299-
ProductInfo(vendor, product, version, location),
285+
ProductInfo(vendor, product, version, file_path),
300286
file_path,
301287
)
302288

0 commit comments

Comments
 (0)