Node_Exporter/vendor/github.com/mdlayher/netlink/fuzz.go
Ben Kochie 0e77317955
Update netlink vendoring (#1471)
* github.com/ema/qdisc
* github.com/mdlayher/genetlink
* github.com/mdlayher/wifi

Signed-off-by: Ben Kochie <superq@gmail.com>
2019-09-05 15:35:13 +02:00

35 lines
512 B
Go

//+build gofuzz
package netlink
func Fuzz(data []byte) int {
return fuzzAttributes(data)
// return fuzzMessage(data)
}
func fuzzAttributes(data []byte) int {
attrs, err := UnmarshalAttributes(data)
if err != nil {
return 0
}
if _, err := MarshalAttributes(attrs); err != nil {
panic(err)
}
return 1
}
func fuzzMessage(data []byte) int {
var m Message
if err := (&m).UnmarshalBinary(data); err != nil {
return 0
}
if _, err := m.MarshalBinary(); err != nil {
panic(err)
}
return 1
}