aboutsummaryrefslogtreecommitdiff
path: root/internal/net/conn.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-06 12:57:23 -0400
committerhistoria <[not public]>2026-10-06 12:57:23 -0400
commit9666676766bf21364f4fc4d0d1d336e72f2a91b4 (patch)
tree0cade34091d7602790dc38cd44053f0b74bbadf2 /internal/net/conn.go
parent4bc1daaf259e0c19c5fe4a12ec8bc7f6e5a735c1 (diff)
downloadthehouseoficarus-9666676766bf21364f4fc4d0d1d336e72f2a91b4.tar.gz
refactor: split casino.go, dedup helpers, remove audit docs
Diffstat (limited to 'internal/net/conn.go')
-rw-r--r--internal/net/conn.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/internal/net/conn.go b/internal/net/conn.go
index d8c867e..df473f5 100644
--- a/internal/net/conn.go
+++ b/internal/net/conn.go
@@ -196,7 +196,19 @@ func stripIAC(s string) string {
i += end + 4
continue
}
- i += 3
+ if b[i+1] == iac {
+ // IAC IAC is an escaped data byte, not a command.
+ out = append(out, iac)
+ i += 2
+ continue
+ }
+ // WILL/WONT/DO/DONT carry an option byte; every other IAC command is
+ // the two-byte form and must not eat the following input byte.
+ if b[i+1] == will || b[i+1] == wont || b[i+1] == do || b[i+1] == dont {
+ i += 3
+ } else {
+ i += 2
+ }
if i > len(b) {
i = len(b)
}