Skip to content

Commit

Permalink
Handle multiple ELAM events (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonweeks authored Mar 8, 2023
1 parent 68deb4c commit 0ccbb50
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion attest/win_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ func (w *WinEvents) parseUTF16(header microsoftEventHeader, r io.Reader) (string
return strings.TrimSuffix(string(utf16.Decode(data)), "\x00"), nil
}

func (w *WinEvents) readELAMAggregation(rdr *bytes.Reader, header microsoftEventHeader) error {
func (w *WinEvents) readELAMAggregation(rdr io.Reader, header microsoftEventHeader) error {
var (
r = &io.LimitedReader{R: rdr, N: int64(header.Size)}
driverName string
Expand All @@ -698,6 +698,11 @@ func (w *WinEvents) readELAMAggregation(rdr *bytes.Reader, header microsoftEvent

var err error
switch h.Type {
case elamAggregation:
w.readELAMAggregation(r, h)
if r.N == 0 {
return nil
}
case elamKeyname:
if driverName != "" {
return errors.New("duplicate driver name in ELAM aggregation event")
Expand Down

0 comments on commit 0ccbb50

Please sign in to comment.