Audit the random number generation source (rand) GSC-G404
Security
Minor
2 years ago2 years old
Use of weak random number generator (math/rand instead of crypto/rand)
21func RandomImageWithSize(size int, data []byte) (image.Image, error) {
22	randExtent := len(palette.WebSafe) - 32
23	rand.Seed(time.Now().UnixNano())
24	colorIndex := rand.Intn(randExtent)25	backColorIndex := colorIndex - 1
26	if backColorIndex < 0 {
27		backColorIndex = randExtent - 1