Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Fix Incorrect conversion between integer types found by GitHub code scanning

天舟1eacb40da2be
diff --git a/server/cache.go b/server/cache.go
index 4a2a52523c..2fbec8d715 100644
--- a/server/cache.go
+++ b/server/cache.go
@@ -32,8 +32,8 @@ func NewCacheService(logger *zap.Logger) *CacheService {
}
func (s *CacheService) FindCache(namespace api.CacheNamespace, id int, entry interface{}) (bool, error) {
- buf1 := []byte{0, 0, 0, 0}
- binary.LittleEndian.PutUint32(buf1, uint32(id))
+ buf1 := []byte{0, 0, 0, 0, 0, 0, 0, 0}
+ binary.LittleEndian.PutUint64(buf1, uint64(id))
buf2, has := s.cache.HasGet(nil, append([]byte(namespace), buf1...))
if has {
@@ -48,8 +48,8 @@ func (s *CacheService) FindCache(namespace api.CacheNamespace, id int, entry int
}
func (s *CacheService) UpsertCache(namespace api.CacheNamespace, id int, entry interface{}) error {
- buf1 := []byte{0, 0, 0, 0}
- binary.LittleEndian.PutUint32(buf1, uint32(id))
+ buf1 := []byte{0, 0, 0, 0, 0, 0, 0, 0}
+ binary.LittleEndian.PutUint64(buf1, uint64(id))
var buf2 bytes.Buffer
enc := gob.NewEncoder(&buf2)