Skip to content

Commit

Permalink
Adding a check for the length of an escaped sequence when unescaping
Browse files Browse the repository at this point in the history
  • Loading branch information
RafBishopFox committed Jan 30, 2024
1 parent a558922 commit 44a863d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions inputrc/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 44a863d

Please sign in to comment.