aboutsummaryrefslogtreecommitdiff
path: root/internal/cvss/v30vector.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cvss/v30vector.go')
-rw-r--r--internal/cvss/v30vector.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/internal/cvss/v30vector.go b/internal/cvss/v30vector.go
index 4154a2f..951cd03 100644
--- a/internal/cvss/v30vector.go
+++ b/internal/cvss/v30vector.go
@@ -1,4 +1,3 @@
-// CVSS vector parser.
package cvss
import (
@@ -43,9 +42,9 @@ func (v v30Vector) Metrics() []Metric {
return r
}
-// create CVSS 3.0 vector from string
+// Create CVSS 3.0 vector from string.
func newV30Vector(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 newV30Vector(s string) (Vector, error) {
// build and return vector
return v30Vector(r), nil
}
+
+// Is the given string a CVSSv3.0 vector string?
+func isV30VectorString(s string) bool {
+ return (len(s) > len(v30Prefix)) && (s[:len(v30Prefix)] == v30Prefix);
+}