aboutsummaryrefslogtreecommitdiff
path: root/internal/cvss/v30vector.go
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2022-01-31 16:42:09 -0500
committerPaul Duncan <pabs@pablotron.org>2022-01-31 16:42:09 -0500
commit702de7c3eb3fd19f7f7d431100b84db5266a3625 (patch)
tree23b9f36e2424363a979c85315f99b147e65f4cf2 /internal/cvss/v30vector.go
parent566e511c9e5cbe6530dcd8212533f11f5d8ecb7a (diff)
downloadcvez-702de7c3eb3fd19f7f7d431100b84db5266a3625.tar.bz2
cvez-702de7c3eb3fd19f7f7d431100b84db5266a3625.zip
internal/cvss: add isV30VectorString() and isV31VectorString(), remove extraneous package docs
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);
+}