Skip to content

Commit 84fc30d

Browse files
Add version list to affected versions, if no range is specified
1 parent 4faea93 commit 84fc30d

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

cve_bin_tool/cve_scanner.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(
5757
self.products_without_cve = 0
5858
self.all_cve_data = defaultdict(CVEData)
5959
self.all_cve_version_info = dict()
60+
self.all_cve_version_list = dict()
6061
self.check_exploits = check_exploits
6162
self.exploits_list = exploits_list
6263
self.disabled_sources = disabled_sources
@@ -136,6 +137,15 @@ def get_cves(self, product_info: ProductInfo, triage_data: TriageData):
136137

137138
cve_list = list(map(lambda x: x[0], self.cursor.fetchall()))
138139

140+
for cve_number in cve_list:
141+
query = """
142+
SELECT version FROM cve_range
143+
WHERE CVE_number=? AND versionStartIncluding='' AND versionStartExcluding='' AND versionEndIncluding='' AND versionEndExcluding=''
144+
"""
145+
self.cursor.execute(query, [cve_number])
146+
affected_versions = list(set(map(lambda x: x[0], self.cursor.fetchall())))
147+
self.all_cve_version_info[cve_number] = VersionInfo('','','','', affected_versions)
148+
139149
# Check for any ranges
140150
query = """
141151
SELECT
@@ -208,6 +218,7 @@ def get_cves(self, product_info: ProductInfo, triage_data: TriageData):
208218
start_excluding=version_start_excluding,
209219
end_including=version_end_including,
210220
end_excluding=version_end_excluding,
221+
version_list=[],
211222
)
212223

213224
product_info_data: CVEData | None = self.all_cve_data.get(product_info)
@@ -252,6 +263,7 @@ def get_cves(self, product_info: ProductInfo, triage_data: TriageData):
252263
self.logger.debug(
253264
f"{row['cve_number']} already reported from {c.data_source}"
254265
)
266+
self.logger.debug(c)
255267
duplicate_found = True
256268
break
257269

cve_bin_tool/output_engine/util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def format_version_range(version_info: VersionInfo) -> str:
123123
Reference for Interval terminologies: https://en.wikipedia.org/wiki/Interval_(mathematics)
124124
"""
125125

126-
(start_including, start_excluding, end_including, end_excluding) = version_info
126+
(start_including, start_excluding, end_including, end_excluding, version_list) = version_info
127127
if start_including and end_including:
128128
return f"[{start_including} - {end_including}]"
129129
if start_including and end_excluding:
@@ -140,6 +140,8 @@ def format_version_range(version_info: VersionInfo) -> str:
140140
return f"<= {end_including}"
141141
if end_excluding:
142142
return f"< {end_excluding}"
143+
if version_list:
144+
return 'list: ' + ", ".join(version_list)
143145
return "-"
144146

145147

cve_bin_tool/util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ class VersionInfo(NamedTuple):
246246
start_excluding: str
247247
end_including: str
248248
end_excluding: str
249+
version_list: list[str]
249250

250251

251252
class CVEData(DefaultDict[str, Union[List[CVE], Set[str]]]):

0 commit comments

Comments
 (0)