mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 12:44:02 +03:00
Add fuzzing for client hello
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package faketls_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/9seconds/mtg/v2/mtglib/internal/faketls"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var FuzzClientHelloSecret = []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
|
||||
|
||||
func FuzzClientHello(f *testing.F) {
|
||||
f.Add([]byte{1, 2, 3})
|
||||
|
||||
f.Fuzz(func(t *testing.T, frame []byte) {
|
||||
_, err := faketls.ParseClientHello(FuzzClientHelloSecret, frame)
|
||||
|
||||
// a probability of having != err is almost negligible
|
||||
require.Error(t, err)
|
||||
})
|
||||
}
|
||||
@@ -19,7 +19,7 @@ const (
|
||||
|
||||
// ClientHelloMinLen is a minimal possible length of
|
||||
// ClientHello record.
|
||||
ClientHelloMinLen = 4
|
||||
ClientHelloMinLen = 6
|
||||
|
||||
// WelcomePacketRandomOffset is an offset of random in ServerHello
|
||||
// packet (including record envelope).
|
||||
|
||||
Reference in New Issue
Block a user