Skip to content

Commit

Permalink
bug: fix zero bytes before message (#11)
Browse files Browse the repository at this point in the history
When retrieving attestations from archivist currently a bunch of zero
bytes are prepended before the message payload.  This causes extra data
to be transmitted as well as payloads being unable to be parsed as json
without the manual removal of these zero bytes.

The buffer used when reading from minio was being initialized with both
size and capacity equal to 8*1024, which causes this issue.  By
initialize it with size 0 and capacity 8*1024 the buffer will start
filling at index 0.

Signed-off-by: Mikhail Swift <mikhail@testifysec.com>
  • Loading branch information
mikhailswift authored Jul 13, 2022
1 parent bdf90f2 commit ff0d1e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/objectstorage/blobstore/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (store *attestationBlobStore) GetRef(obj []byte) (string, error) {
func (store *attestationBlobStore) GetBlob(idx string) ([]byte, error) {
opt := minio.GetObjectOptions{}
chunkSize := 8 * 1024
buf := make([]byte, chunkSize)
buf := make([]byte, 0, chunkSize)
outBuf := bytes.NewBuffer(buf)

obj, err := store.client.GetObject(store.bucket, idx, opt)
Expand Down

0 comments on commit ff0d1e9

Please sign in to comment.