From 35d7d04cd0004e791873db6681bd4c64cef864d8 Mon Sep 17 00:00:00 2001 From: Matt Dainty Date: Mon, 24 Apr 2023 00:14:05 +0100 Subject: [PATCH] Return 0 on read error --- internal/aes7z/reader.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/aes7z/reader.go b/internal/aes7z/reader.go index fbf8769..4d0d30c 100644 --- a/internal/aes7z/reader.go +++ b/internal/aes7z/reader.go @@ -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[:])