Skip to content

Commit

Permalink
fix: InputCollector byte copy range
Browse files Browse the repository at this point in the history
Only copy the number of bytes read instead of the whole buffer.
  • Loading branch information
LBeernaertProton committed Mar 21, 2023
1 parent 45de5f1 commit 2d09826
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions imap/command/input_collector.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package command

import "github.com/ProtonMail/gluon/rfcparser"
import (
"github.com/ProtonMail/gluon/rfcparser"
)

type InputCollector struct {
source rfcparser.Reader
Expand All @@ -21,7 +23,7 @@ func (i *InputCollector) Bytes() []byte {
func (i *InputCollector) Read(dst []byte) (int, error) {
n, err := i.source.Read(dst)
if err == nil {
i.bytes = append(i.bytes, dst...)
i.bytes = append(i.bytes, dst[0:n]...)
}

return n, err
Expand Down

0 comments on commit 2d09826

Please sign in to comment.