From: Rui Ueyama Date: Mon, 17 Mar 2014 19:07:30 +0000 (-0700) Subject: encoding/hex: add error check for write error. X-Git-Tag: go1.3beta1~344 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=01d49dc2ddda443f302be8ca0aa1378d550687ef;p=gostls13.git encoding/hex: add error check for write error. I believe the original author of this code just forgot to check for error here. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/76760043 --- diff --git a/src/pkg/encoding/hex/hex.go b/src/pkg/encoding/hex/hex.go index 167d00e032..d1fc7024a9 100644 --- a/src/pkg/encoding/hex/hex.go +++ b/src/pkg/encoding/hex/hex.go @@ -146,6 +146,9 @@ func (h *dumper) Write(data []byte) (n int, err error) { h.buf[12] = ' ' h.buf[13] = ' ' _, err = h.w.Write(h.buf[4:]) + if err != nil { + return + } } Encode(h.buf[:], data[i:i+1]) h.buf[2] = ' '