Skip to content

Commit

Permalink
Fix segfault on name that is an invalid regex
Browse files Browse the repository at this point in the history
  • Loading branch information
purplesyringa committed Dec 31, 2023
1 parent db136df commit ffcaa50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chat/message/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (u *User) HasMessages() bool {

// SetHighlight sets the highlighting regular expression to match string.
func (u *User) SetHighlight(s string) error {
re, err := regexp.Compile(fmt.Sprintf(reHighlight, s))
re, err := regexp.Compile(fmt.Sprintf(reHighlight, regexp.QuoteMeta(s)))
if err != nil {
return err
}
Expand Down

0 comments on commit ffcaa50

Please sign in to comment.