Skip to content

Commit 0eebb64

Browse files
committed
sshd/terminal/terminal.go: Clamp pos to protect from some fuzzing failures
1 parent db14517 commit 0eebb64

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sshd/terminal/terminal.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ func (t *Terminal) moveCursorToPos(pos int) {
264264
return
265265
}
266266

267+
if pos > len(t.line) {
268+
pos = len(t.line)
269+
}
270+
267271
x := visualLength(t.prompt) + visualLength(t.line[:pos])
268272
y := x / t.termWidth
269273
x = x % t.termWidth

0 commit comments

Comments
 (0)