diff options
| author | historia <[not public]> | 2026-10-06 12:57:23 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-06 12:57:23 -0400 |
| commit | 9666676766bf21364f4fc4d0d1d336e72f2a91b4 (patch) | |
| tree | 0cade34091d7602790dc38cd44053f0b74bbadf2 /internal/net/iac_test.go | |
| parent | 4bc1daaf259e0c19c5fe4a12ec8bc7f6e5a735c1 (diff) | |
| download | thehouseoficarus-9666676766bf21364f4fc4d0d1d336e72f2a91b4.tar.gz | |
refactor: split casino.go, dedup helpers, remove audit docs
Diffstat (limited to 'internal/net/iac_test.go')
| -rw-r--r-- | internal/net/iac_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/net/iac_test.go b/internal/net/iac_test.go index 71570db..6f91f19 100644 --- a/internal/net/iac_test.go +++ b/internal/net/iac_test.go @@ -15,3 +15,18 @@ func TestStripIACDropsTruncatedSequence(t *testing.T) { t.Fatalf("stripIAC(subnegotiation) = %q, want xy", got) } } + +func TestStripIACPreservesInputAfterTwoByteCommand(t *testing.T) { + // A 2-byte command (NOP) in the middle must not eat the following byte. + if got := stripIAC("a" + string([]byte{iac, 0xf1}) + "b"); got != "ab" { + t.Fatalf("stripIAC(mid two-byte command) = %q, want %q", got, "ab") + } + // A 3-byte negotiation command consumes its option byte. + if got := stripIAC("a" + string([]byte{iac, will, echo}) + "b"); got != "ab" { + t.Fatalf("stripIAC(three-byte command) = %q, want %q", got, "ab") + } + // IAC IAC is an escaped literal 0xFF, not a command. + if got := stripIAC("a" + string([]byte{iac, iac}) + "b"); got != "a"+string([]byte{iac})+"b" { + t.Fatalf("stripIAC(escaped IAC) = %q, want literal 0xFF", got) + } +} |
