From 4a0eb2ac6eb554cb0833e84a7b51660ddb8c8908 Mon Sep 17 00:00:00 2001 From: Tariq Ibrahim <tariq181290@gmail.com> Date: Fri, 3 May 2019 14:23:09 -0700 Subject: [PATCH] add errcheck for Digest method in sign.go Signed-off-by: Tariq Ibrahim <tariq181290@gmail.com> --- pkg/provenance/sign.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/provenance/sign.go b/pkg/provenance/sign.go index 5e23c2dda..5a7626424 100644 --- a/pkg/provenance/sign.go +++ b/pkg/provenance/sign.go @@ -404,6 +404,8 @@ func DigestFile(filename string) (string, error) { // Helm uses SHA256 as its default hash for all non-cryptographic applications. func Digest(in io.Reader) (string, error) { hash := crypto.SHA256.New() - io.Copy(hash, in) + if _, err := io.Copy(hash, in); err != nil { + return "", nil + } return hex.EncodeToString(hash.Sum(nil)), nil } -- GitLab