From 98f5f30e75338dcb4cd1c789d864469962da7aa3 Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Mon, 1 Dec 2014 15:57:05 -0800 Subject: [PATCH] Create copy of buffer for SignedManifest.Raw Without this copy, the buffer may be re-used in the json package, causing missing or corrupted content for the long-lived SignedManifest object. By creating a new buffer, owned by the SignedManifest object, the content remains stable. --- storage/manifest.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/manifest.go b/storage/manifest.go index 8b288625..895a112e 100644 --- a/storage/manifest.go +++ b/storage/manifest.go @@ -174,7 +174,8 @@ func (sm *SignedManifest) UnmarshalJSON(b []byte) error { } sm.Manifest = manifest - sm.Raw = b + sm.Raw = make([]byte, len(b), len(b)) + copy(sm.Raw, b) return nil }