From 8ac7f2d8583602e52cb95aa5d39b326a74770437 Mon Sep 17 00:00:00 2001 From: alexmullins Date: Fri, 6 Nov 2015 01:44:41 -0600 Subject: [PATCH] Check error return from mac.Write --- crypto.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crypto.go b/crypto.go index caf45b4..e83df6a 100644 --- a/crypto.go +++ b/crypto.go @@ -209,7 +209,11 @@ func (a *bufferedAuthReader) Read(b []byte) (int, error) { a.err = ErrDecryption return 0, a.err } - a.mac.Write(a.buf.Bytes()) + mn, err := a.mac.Write(a.buf.Bytes()) + if mn != a.buf.Len() || err != nil { + a.err = ErrDecryption + return 0, a.err + } if !a.checkAuthentication(ab.Bytes()) { a.err = ErrDecryption return 0, a.err