aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2022-02-19 16:24:24 -0500
committerPaul Duncan <pabs@pablotron.org>2022-02-19 16:24:24 -0500
commitf636d7bb549d8cdfac68763120cfc374c4bc9542 (patch)
treefc4dc855a611b367c87676e062a93110a2919aef
parentaa21bbd6a24d38202c57d01382c20806752c7540 (diff)
downloadcvez-f636d7bb549d8cdfac68763120cfc374c4bc9542.tar.bz2
cvez-f636d7bb549d8cdfac68763120cfc374c4bc9542.zip
feed/cveid.go: shift start year to 1999 and end year to 2126 to handle CVEs from 1999
-rw-r--r--feed/cveid.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/feed/cveid.go b/feed/cveid.go
index 8796029..5e43ad3 100644
--- a/feed/cveid.go
+++ b/feed/cveid.go
@@ -21,7 +21,7 @@ func parseCveIdYear(s string) (uint16, error) {
}
// check bounds
- if year < 2000 || year > 2127 {
+ if year < 1999 || year > 2126 {
return 0, fmt.Errorf("year out of bounds: %s", s)
}
@@ -48,7 +48,7 @@ func parseCveIdNum(s string) (uint32, error) {
// Encode CVE ID as uint32.
func encodeCveId(year uint16, num uint32) uint32 {
- return uint32((uint32((year - 2000) & 0x7f) << 25) | (num & 0x01ffffff))
+ return uint32((uint32((year - 1999) & 0x7f) << 25) | (num & 0x01ffffff))
}
// Create CVE ID from string.
@@ -98,7 +98,7 @@ func (me *CveId) UnmarshalJSON(b []byte) error {
// Get year component.
func (me CveId) Year() uint16 {
- return uint16((uint32(me) >> 25) & 0x7f) + 2000
+ return uint16((uint32(me) >> 25) & 0x7f) + 1999
}
// Get number component.