Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit d63e0ae

Browse files
committed
fix: handle io.ReadFull error
1 parent 1464fbe commit d63e0ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ func encrypt(data []byte, p passphrase, channel chan encryptedData, wg *sync.Wai
4343
block, _ := aes.NewCipher([]byte(createHash(string(p))))
4444
gcm, _ := cipher.NewGCM(block)
4545
nonce := make([]byte, gcm.NonceSize())
46-
_, _ = io.ReadFull(rand.Reader, nonce)
46+
_, err := io.ReadFull(rand.Reader, nonce)
47+
if err != nil {
48+
log.Fatalln(err)
49+
}
4750
cipherText := gcm.Seal(nonce, nonce, data, nil)
4851
channel <- cipherText
4952
}

0 commit comments

Comments
 (0)