Skip to content

Commit

Permalink
Return 0 on read error
Browse files Browse the repository at this point in the history
  • Loading branch information
bodgit committed Apr 23, 2023
1 parent c7dab89 commit 35d7d04
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/aes7z/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ func (rc *readCloser) Read(p []byte) (int, error) {
var block [aes.BlockSize]byte

for rc.buf.Len() < len(p) {
if n, err := io.ReadFull(rc.rc, block[:]); err != nil {
if err == io.EOF {
if _, err := io.ReadFull(rc.rc, block[:]); err != nil {
if errors.Is(err, io.EOF) {
break
}

return n, err
return 0, err
}

rc.cbc.CryptBlocks(block[:], block[:])
Expand Down

0 comments on commit 35d7d04

Please sign in to comment.