aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/pkg/sftp/fuzz.go
blob: 169aebc28482ada2843a8e428897560e225640c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// +build gofuzz

package sftp

import "bytes"

type sinkfuzz struct{}

func (*sinkfuzz) Close() error                { return nil }
func (*sinkfuzz) Write(p []byte) (int, error) { return len(p), nil }

var devnull = &sinkfuzz{}

// To run: go-fuzz-build && go-fuzz
func Fuzz(data []byte) int {
	c, err := NewClientPipe(bytes.NewReader(data), devnull)
	if err != nil {
		return 0
	}
	c.Close()
	return 1
}