aboutsummaryrefslogtreecommitdiff
path: root/internal/cvss/v31vector.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cvss/v31vector.go')
-rw-r--r--internal/cvss/v31vector.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/internal/cvss/v31vector.go b/internal/cvss/v31vector.go
index 65536cf..92fb1e6 100644
--- a/internal/cvss/v31vector.go
+++ b/internal/cvss/v31vector.go
@@ -1,4 +1,3 @@
-// CVSS vector parser.
package cvss
import (
@@ -43,9 +42,9 @@ func (v v31Vector) Metrics() []Metric {
return r
}
-// create CVSS 3.1 vector from string
+// create CVSS 3.1 vector from string.
func newV31Vector(s string) (Vector, error) {
- strs := strings.Split(s, "/")
+ strs := strings.Split(s[len(v31Prefix):], "/")
r := make([]v3Metric, len(strs))
// walk metric strings
@@ -63,3 +62,8 @@ func newV31Vector(s string) (Vector, error) {
// build and return vector
return v31Vector(r), nil
}
+
+// Is the given string a CVSSv3.1 vector string?
+func isV31VectorString(s string) bool {
+ return (len(s) > len(v31Prefix)) && (s[:len(v31Prefix)] == v31Prefix);
+}