mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-12 15:17:16 +03:00
sshd/terminal/terminal.go: Clamp pos to protect from some fuzzing failures
This commit is contained in:
parent
db14517499
commit
0eebb64c1d
@ -264,6 +264,10 @@ func (t *Terminal) moveCursorToPos(pos int) {
|
||||
return
|
||||
}
|
||||
|
||||
if pos > len(t.line) {
|
||||
pos = len(t.line)
|
||||
}
|
||||
|
||||
x := visualLength(t.prompt) + visualLength(t.line[:pos])
|
||||
y := x / t.termWidth
|
||||
x = x % t.termWidth
|
||||
|
Loading…
x
Reference in New Issue
Block a user