aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-03-23 15:38:14 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-03-23 15:38:14 +0100
commit530f1ac53cf4057de39225a21e910f10fb8ab62f (patch)
tree0f0344dc7725ae96a8f6defd4b4cb04df3f686c2
parent0836152aed30145bb133c86c0360587bb8797fb3 (diff)
fixed copy bug
The get-entries response was copied incorrectly. Therefore, the returned range contained the same (last) StItem repeatedly. Fixed by ensuring that `&item` refers to a newly allocated `item` in the loop.
-rw-r--r--client/client.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/client/client.go b/client/client.go
index 1a3470f..ba81f4d 100644
--- a/client/client.go
+++ b/client/client.go
@@ -198,7 +198,8 @@ func (c *Client) GetEntries(ctx context.Context, start, end uint64) ([]*types.St
return nil, fmt.Errorf("Unmarshal: %v", err)
}
ret := make([]*types.StItem, 0, len(list.Items))
- for _, item := range list.Items {
+ for i, _ := range list.Items {
+ item := list.Items[i]
if got, want := item.Format, types.StFormatSignedChecksumV1; got != want {
return nil, fmt.Errorf("unexpected StItem format: %v", got)
}