Commit ee11a56
committed
Error when XBoard opponent has newline in name
Use the configuration machinery to send the opponent's information
to the engine instead of using the Opponent class directly. This will
make sure that an exception is raised if the opponent's name has
newlines in it before send_line() is called. This prevents opponents
from injecting commands into the engine. For example, if an
opponent sets their name as "Cheat\neasy", then the following
commands will be sent to the local engine
name Cheat
easy
which would cause the engine to turn off pondering.
Also, add tests to show the change works as expected.1 parent 77bb7b2 commit ee11a56
2 files changed
Lines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2152 | 2152 | | |
2153 | 2153 | | |
2154 | 2154 | | |
| 2155 | + | |
2155 | 2156 | | |
2156 | 2157 | | |
2157 | 2158 | | |
| |||
2172 | 2173 | | |
2173 | 2174 | | |
2174 | 2175 | | |
2175 | | - | |
| 2176 | + | |
2176 | 2177 | | |
2177 | 2178 | | |
2178 | 2179 | | |
2179 | | - | |
2180 | | - | |
2181 | | - | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
2182 | 2184 | | |
2183 | | - | |
| 2185 | + | |
2184 | 2186 | | |
2185 | 2187 | | |
2186 | 2188 | | |
| |||
2518 | 2520 | | |
2519 | 2521 | | |
2520 | 2522 | | |
2521 | | - | |
| 2523 | + | |
2522 | 2524 | | |
2523 | 2525 | | |
2524 | 2526 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3688 | 3688 | | |
3689 | 3689 | | |
3690 | 3690 | | |
| 3691 | + | |
| 3692 | + | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
| 3696 | + | |
| 3697 | + | |
| 3698 | + | |
| 3699 | + | |
3691 | 3700 | | |
3692 | 3701 | | |
3693 | 3702 | | |
| |||
0 commit comments