From 702de7c3eb3fd19f7f7d431100b84db5266a3625 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Mon, 31 Jan 2022 16:42:09 -0500 Subject: internal/cvss: add isV30VectorString() and isV31VectorString(), remove extraneous package docs --- internal/cvss/cvss.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'internal/cvss/cvss.go') diff --git a/internal/cvss/cvss.go b/internal/cvss/cvss.go index 0e18656..9839e84 100644 --- a/internal/cvss/cvss.go +++ b/internal/cvss/cvss.go @@ -36,12 +36,12 @@ type Vector interface { // Create new CVSS vector from vector string. func NewVector(s string) (Vector, error) { - if len(s) > len(v31Prefix) && s[:len(v31Prefix)] == v31Prefix { - // create CVSS v2.0 vector. - return newV31Vector(s[len(v31Prefix):]) - } else if len(s) > len(v30Prefix) && s[:len(v30Prefix)] == v30Prefix { + if isV31VectorString(s) { + // create CVSS v3.1 vector. + return newV31Vector(s) + } else if isV30VectorString(s) { // create CVSS v3.0 vector. - return newV30Vector(s[len(v30Prefix):]) + return newV30Vector(s) } else { // create CVSS V2 vector return newV2Vector(s) -- cgit v1.2.3