From d7fba0e89d63d407589111b38f25151087b4f17a Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 21 Dec 2015 15:41:23 -0600 Subject: [PATCH] revocation: fix nil pointer panic in shachain constructor --- revocation/shachain.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/revocation/shachain.go b/revocation/shachain.go index 5ca55f79b..e76897d39 100644 --- a/revocation/shachain.go +++ b/revocation/shachain.go @@ -44,7 +44,7 @@ func NewHyperShaChain() *HyperShaChain { // NewHyperShaChainFromSeed... // * used to derive your own pre-images func NewHyperShaChainFromSeed(seed *[32]byte, deriveTo uint64) (*HyperShaChain, error) { - var shaSeed *[32]byte + var shaSeed [32]byte // If no seed is specified, generate a new one. if seed == nil { @@ -52,13 +52,15 @@ func NewHyperShaChainFromSeed(seed *[32]byte, deriveTo uint64) (*HyperShaChain, if err != nil { return nil, err } + } else { + shaSeed = *seed } // The last possible value in the chain is our starting index. start := uint64(maxIndex) stop := deriveTo - curHash := derive(start, stop, *shaSeed) + curHash := derive(start, stop, shaSeed) // TODO(roasbeef): from/to or static size? return &HyperShaChain{lastChainIndex: deriveTo, lastHash: curHash}, nil