From 44a863d8aa642fcc2d2475e56b7e4c5ecac30c69 Mon Sep 17 00:00:00 2001 From: Raf <84349012+RafBishopFox@users.noreply.github.com> Date: Tue, 30 Jan 2024 08:17:05 -0500 Subject: [PATCH] Adding a check for the length of an escaped sequence when unescaping --- inputrc/parse.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inputrc/parse.go b/inputrc/parse.go index 429aa12..d261211 100644 --- a/inputrc/parse.go +++ b/inputrc/parse.go @@ -620,6 +620,10 @@ func unescapeRunes(r []rune, i, end int) string { var seq []rune var char0, char1, char2, char3, char4, char5 rune + if len(r) == 1 { + return string(r) + } + for ; i < end; i++ { if char0 = r[i]; char0 == '\\' { char1, char2, char3, char4, char5 = grab(r, i+1, end), grab(r, i+2, end), grab(r, i+3, end), grab(r, i+4, end), grab(r, i+5, end)