use crypto/rand instead of math/rand to avoid port conflicts and security issues

This commit is contained in:
aler9
2021-09-23 19:37:26 +02:00
parent 5ef9076357
commit 0454e5407f
5 changed files with 41 additions and 13 deletions

View File

@@ -32,7 +32,7 @@ func extractPort(address string) (int, error) {
func newSessionSecretID(sessions map[string]*ServerSession) (string, error) {
for {
b := make([]byte, 4)
_, err := rand.Read(b)
_, err := rand.Read(b[:])
if err != nil {
return "", err
}