0

Fix panic on empty/short message in MsgParser

- Add bounds check before slicing message for csign prefix detection
- Prevents index out of range panic when message is empty or shorter than csign
This commit is contained in:
eleksir
2026-03-30 01:45:54 +03:00
parent 41bdd6685a
commit 97b337db31
2 changed files with 1 additions and 8 deletions

View File

@@ -90,7 +90,7 @@ func MsgParser(ctx context.Context, msg string) {
j.Misc.Fwdcnt++
// Классифицирем входящие сообщения. Первым делом, попробуем определить команды.
if j.Message[0:len(j.Misc.Csign)] == j.Misc.Csign {
if len(j.Message) >= len(j.Misc.Csign) && j.Message[0:len(j.Misc.Csign)] == j.Misc.Csign {
// Может быть, это команда модуля phrases?
var (
done = false