mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-07-02 19:54:29 +02: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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if pos > len(t.line) {
|
||||||
|
pos = len(t.line)
|
||||||
|
}
|
||||||
|
|
||||||
x := visualLength(t.prompt) + visualLength(t.line[:pos])
|
x := visualLength(t.prompt) + visualLength(t.line[:pos])
|
||||||
y := x / t.termWidth
|
y := x / t.termWidth
|
||||||
x = x % t.termWidth
|
x = x % t.termWidth
|
||||||
|
Loading…
x
Reference in New Issue
Block a user