Skip to content

Commit f627fab

Browse files
authored
fix: fix false positives with filename patterns (#2521)
Use match instead of search to only detect a match at the beginning of the filename for FILENAME_PATTERNS otherwise false positives will be raised. For example: - named (i.e. bind) for systemd-hostnamed - eroute (i.e. openswan) for traceroute6 - scp (i.e. openssh) for libxt_dscp.so - libc (i.e. glibc) for libuClibc.so Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent 35e5133 commit f627fab

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
@@ -319,7 +319,7 @@ def guess_contains(self, lines):
319319
def get_version(self, lines, filename):
320320
version_info = dict()
321321

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

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

0 commit comments

Comments
 (0)