Skip to content

Commit

Permalink
fix: return valid byte slice on csaf channel
Browse files Browse the repository at this point in the history
Send a newly created byte slice with the csaf document content on the channel. Previously the sent byte slice was gained from the method `Buffer.Bytes()`. However this "slice is valid for use only until the next buffer modification" and therefore modified with the next buffer modification..
  • Loading branch information
mgoetzegb committed Sep 26, 2024
1 parent fc19f51 commit 8b7c6d8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/csaf_downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"os"
"path"
"path/filepath"
"slices"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -678,7 +679,8 @@ nextAdvisory:
}

if d.cfg.ForwardChannel {
d.Csafs <- data.Bytes()
// the bytes slice is modified by the next buffer modification, so we need to copy it
d.Csafs <- slices.Clone(data.Bytes())
}

if d.cfg.NoStore {
Expand Down

0 comments on commit 8b7c6d8

Please sign in to comment.