aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/pkg/sftp/fuzz.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/pkg/sftp/fuzz.go')
-rw-r--r--vendor/github.com/pkg/sftp/fuzz.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/github.com/pkg/sftp/fuzz.go b/vendor/github.com/pkg/sftp/fuzz.go
new file mode 100644
index 000000000..169aebc28
--- /dev/null
+++ b/vendor/github.com/pkg/sftp/fuzz.go
@@ -0,0 +1,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
+}