diff options
Diffstat (limited to 'internal/net/conn.go')
| -rw-r--r-- | internal/net/conn.go | 14 |
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) } |
