aboutsummaryrefslogtreecommitdiff
path: root/reqres.go
diff options
context:
space:
mode:
Diffstat (limited to 'reqres.go')
-rw-r--r--reqres.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/reqres.go b/reqres.go
index 8e1c454..14729ea 100644
--- a/reqres.go
+++ b/reqres.go
@@ -114,12 +114,15 @@ func (lp *LogParameters) newGetProofByHashRequest(httpRequest *http.Request) (*G
return nil, fmt.Errorf("bad tree_size parameter: %v", err)
}
if size < 1 {
- return nil, fmt.Errorf("bad tree_size parameter: negative value")
+ return nil, fmt.Errorf("bad tree_size parameter: must be larger than zero")
}
hash, err := deb64(httpRequest.FormValue("hash"))
if err != nil {
return nil, fmt.Errorf("bad hash parameter: %v", err)
}
+ if len(hash) != lp.HashType.Size() {
+ return nil, fmt.Errorf("bad hash parameter: must be %d bytes", lp.HashType.Size())
+ }
return &GetProofByHashRequest{TreeSize: size, Hash: hash}, nil
}