Skip to content

Commit

Permalink
fix: getReal helper metric proper fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
pandatix committed Dec 4, 2023
1 parent 65e6817 commit f100472
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/cvss40.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,16 @@ class CVSS40 {
}

#getReal(metric) {
// Check if the environmental metric exists and is defined
var v = this.Get('M' + metric);
if (v != undefined && v != 'X') {
return v;
if (['AV', 'AC', 'AT', 'PR', 'UI', 'VC', 'VI', 'VA', 'SC', 'SI', 'SA'].includes(metric)) {
var v = this.Get('M' + metric);
if (v != 'X') {
return v
}
return this.Get(metric);
}
// Fallback to the base metric
v = this.Get(metric);
var v = this.Get(metric);
if (v != 'X') {
return v;
return v
}
// If it was not a base metric then defaults
switch (metric) {
Expand Down

0 comments on commit f100472

Please sign in to comment.