Commit 2c920ab
Yogthos
fix: prevent DoS in sanitize_output ESC sequence handling
Found during self-review of commit 3b5ba98:
- CSI consumer (ESC [ / ESC ]) now capped at 256 iterations.
An unterminated sequence like '\x1b[no-alpha-here' would
previously consume all remaining output. Now it stops after
256 chars, preserving the rest of the content.
- DCS/APC/PM/SOS consumer (ESC P/X/^+_) now capped at 4 KB.
Same issue — unterminated DCS would eat all output.
- main.rs --loop validation: return the sanitized 'safe' string
instead of the raw 'combined' to the transcript saver, so
future reads from the transcript don't expose raw controls.1 parent 3b5ba98 commit 2c920ab
2 files changed
Lines changed: 15 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1060 | 1060 | | |
1061 | 1061 | | |
1062 | 1062 | | |
1063 | | - | |
| 1063 | + | |
1064 | 1064 | | |
1065 | 1065 | | |
1066 | 1066 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
229 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
230 | 232 | | |
231 | 233 | | |
232 | 234 | | |
233 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
234 | 240 | | |
235 | 241 | | |
236 | | - | |
| 242 | + | |
237 | 243 | | |
238 | 244 | | |
| 245 | + | |
239 | 246 | | |
240 | 247 | | |
241 | 248 | | |
242 | 249 | | |
243 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
244 | 255 | | |
245 | 256 | | |
246 | 257 | | |
| |||
0 commit comments