Skip to content

Commit

Permalink
Pass buffer by reference!
Browse files Browse the repository at this point in the history
  • Loading branch information
czeumer committed Jul 12, 2023
1 parent 250d4bb commit e5137e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ossec/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ func (a *Client) readServerResponse(timeout time.Duration) error {
totallyRead := 0
messagesRead := 0

totallyRead, shouldReturn, err := readResponse(timeout, a, totallyRead, messagesRead, buf)
totallyRead, shouldReturn, err := readResponse(timeout, a, totallyRead, messagesRead, &buf)
if err != nil {
return err
}
Expand Down Expand Up @@ -817,7 +817,7 @@ func (a *Client) readServerResponse(timeout time.Duration) error {
return nil
}

func readResponse(timeout time.Duration, a *Client, totallyRead int, messagesRead int, buf bytes.Buffer) (int, bool, error) {
func readResponse(timeout time.Duration, a *Client, totallyRead int, messagesRead int, buf *bytes.Buffer) (int, bool, error) {
deadline := time.Now().Add(timeout)
err := a.conn.SetReadDeadline(deadline)
if err != nil {
Expand Down

0 comments on commit e5137e9

Please sign in to comment.