aboutsummaryrefslogtreecommitdiff
path: root/internal/cvss/v31vector.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/v31vector.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/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);
+}