aboutsummaryrefslogtreecommitdiff
path: root/internal/net/iac_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-05 17:05:14 -0400
committerhistoria <[not public]>2026-10-05 17:05:14 -0400
commite42952469dadfb3535633c66c881050ac128703c (patch)
treea78f7396b72cdbd6fa4f6c454c830f40cf2ad0cb /internal/net/iac_test.go
parent90ad8c0c33b519d5830c69d4128bdc984b5e9de8 (diff)
downloadthehouseoficarus-e42952469dadfb3535633c66c881050ac128703c.tar.gz
fix: gather verbs, walk oom, admin path bypass, roulette refund
Diffstat (limited to 'internal/net/iac_test.go')
-rw-r--r--internal/net/iac_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/net/iac_test.go b/internal/net/iac_test.go
new file mode 100644
index 0000000..71570db
--- /dev/null
+++ b/internal/net/iac_test.go
@@ -0,0 +1,17 @@
+package net
+
+import "testing"
+
+// Regression: stripIAC required a third byte, so a trailing 2-byte IAC command
+// leaked its option byte into player input.
+func TestStripIACDropsTruncatedSequence(t *testing.T) {
+ got := stripIAC("abc" + string([]byte{iac, 0xf1}))
+ if got != "abc" {
+ t.Fatalf("stripIAC(truncated) = %q, want %q", got, "abc")
+ }
+ // A full subnegotiation is still removed.
+ got = stripIAC("x" + string([]byte{iac, sb, 1, 2}) + string([]byte{iac, se}) + "y")
+ if got != "xy" {
+ t.Fatalf("stripIAC(subnegotiation) = %q, want xy", got)
+ }
+}