Skip to content

sshproxy: Splitter.Write might send duplicated data #72

Description

@dolmen

In cmd/sshproxy/recorder.go, the Splitter.Write method might send records with duplicated data, in the case where partial writes are happening on the underlying file, because Splitter.Write doesn't check how much data is effectively written. If the write doesn't happen at once, the successive writes of the remaining bytes will be sent again as new records.

// Write implements the Writer Write method. It sends a copy of the written
// slice to its internal channel.
func (s *Splitter) Write(p []byte) (int, error) {
pp := Dup(p, len(p))
s.ch <- record.Record{
Time: time.Now(),
Fd: s.fd,
Size: len(p),
Data: pp,
}
return s.f.Write(p)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions