mirror of
https://github.com/db9979/sshtermy.git
synced 2026-12-06 12:44:08 +01:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUkBzZ657Au6Rz4BPXj
30 lines
655 B
Go
30 lines
655 B
Go
package syncx
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/db9979/sshtermy/internal/fuzzguard"
|
|
)
|
|
|
|
// Die Sync-Datei liegt in einem fremden Ordner (Cloud, WebDAV, USB-Stick):
|
|
// kaputte oder manipulierte Dateien müssen sauber abgelehnt werden.
|
|
func FuzzDecode(f *testing.F) {
|
|
k, err := NewKey([]byte("ein langes sync passwort"))
|
|
if err != nil {
|
|
f.Fatal(err)
|
|
}
|
|
good, err := Encode(k, &Payload{})
|
|
if err != nil {
|
|
f.Fatal(err)
|
|
}
|
|
f.Add(good)
|
|
f.Add([]byte(`{"format":"sshtermy-sync","version":99}`))
|
|
f.Add([]byte(`{}`))
|
|
f.Fuzz(func(t *testing.T, raw []byte) {
|
|
fuzzguard.Run(t, func() {
|
|
_, _ = Decode(k, raw)
|
|
_, _ = ParseKey(string(raw))
|
|
})
|
|
})
|
|
}
|