Skip to content

writer-buffer-mutation

Default severity: error

The io.Writer contract requires Write implementations not to modify the provided byte slice, even temporarily. Mutating an element or appending into the input can corrupt caller-owned data.

func (w *writer) Write(p []byte) (int, error) { p[0] = 0; return len(p), nil }
func (w *writer) Write(p []byte) (int, error) { return w.dst.Write(p) }