Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reads from crypto/rand not checked for errors #25

Closed
mikegorman-nf opened this issue Mar 26, 2024 · 0 comments
Closed

Reads from crypto/rand not checked for errors #25

mikegorman-nf opened this issue Mar 26, 2024 · 0 comments
Labels
security Anything potentially security related

Comments

@mikegorman-nf
Copy link
Member

There are a couple of places where reads from crypto/rand are not checked for errors:

_, _ = rand.Read(k)

_, _ = rand.Read(header)

While https://pkg.go.dev/crypto/rand#Read does not require a check on the number of bytes read, it should probably have a check for errors. If an error occurs, there may be no read and the key material may be predictable.

@mikegorman-nf mikegorman-nf added the security Anything potentially security related label Mar 26, 2024
ekoby added a commit that referenced this issue Mar 26, 2024
@ekoby ekoby closed this as completed in 8b7a069 Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security Anything potentially security related
Projects
None yet
Development

No branches or pull requests

1 participant