diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-01-31 22:16:23 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-01-31 22:16:23 -0500 |
commit | 5c4ff27a0bc70cdefad0c9a68e920e480465c4d9 (patch) | |
tree | 1cad646424696fab83956d2f042d00551228d962 /internal/cvss/v3metric.go | |
parent | 6b80bfb7889444cdb9ab07dcd5fe2fcb2000ce8e (diff) | |
download | cvez-5c4ff27a0bc70cdefad0c9a68e920e480465c4d9.tar.bz2 cvez-5c4ff27a0bc70cdefad0c9a68e920e480465c4d9.zip |
internal/cvss: handle invalid keys and metrics
Diffstat (limited to 'internal/cvss/v3metric.go')
-rw-r--r-- | internal/cvss/v3metric.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/cvss/v3metric.go b/internal/cvss/v3metric.go index a8f25de..e9a6763 100644 --- a/internal/cvss/v3metric.go +++ b/internal/cvss/v3metric.go @@ -314,8 +314,11 @@ var v3MetricStrLut = map[string]v3Metric { // Get CVSS 3.x metric key. func (m v3Metric) Key() Key { - k, _ := v3KeyLut[m] - return k + if k, ok := v3KeyLut[m]; ok { + return k + } else { + return v3InvalidKey + } } // Convert string to CVSS 3.1 metric. |