From f636d7bb549d8cdfac68763120cfc374c4bc9542 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sat, 19 Feb 2022 16:24:24 -0500 Subject: feed/cveid.go: shift start year to 1999 and end year to 2126 to handle CVEs from 1999 --- feed/cveid.go | 6 +++--- 1 file 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. -- cgit v1.2.3