Check error return from mac.Write

This commit is contained in:
alexmullins 2015-11-06 01:44:41 -06:00
parent 42f3489e0b
commit 8ac7f2d858
1 changed files with 5 additions and 1 deletions

View File

@ -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