From ffcaa50b14117cc2e24773f3ae0f8122e795cdae Mon Sep 17 00:00:00 2001 From: Alisa Sireneva Date: Sun, 31 Dec 2023 17:10:33 +0300 Subject: [PATCH] Fix segfault on name that is an invalid regex --- chat/message/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chat/message/user.go b/chat/message/user.go index 122f21a..fd04acc 100644 --- a/chat/message/user.go +++ b/chat/message/user.go @@ -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 }