blob: 71570dbd22ed237ecd2d94898506fe70537950f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)
}
}
|