Skip to content

Commit c27b3e1

Browse files
committed
fix: fix false positives with filename patterns
Use match instead of search to only detect exact match for FILENAME_PATTERNS otherwise false positives will be raised, for example: - named (i.e. bind) will be detected in systemd-hostnamed - eroute (i.e. openswan) will be detected in traceroute6 - libc (i.e. glibc) will be detected in libuClibc.so Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent 85d1f25 commit c27b3e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cve_bin_tool/checkers/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def guess_contains(self, lines):
318318
def get_version(self, lines, filename):
319319
version_info = dict()
320320

321-
if any(pattern.search(filename) for pattern in self.FILENAME_PATTERNS):
321+
if any(pattern.match(filename) for pattern in self.FILENAME_PATTERNS):
322322
version_info["is_or_contains"] = "is"
323323

324324
if "is_or_contains" not in version_info and self.guess_contains(lines):

0 commit comments

Comments
 (0)