mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
fix: possible sql inject
This commit is contained in:
parent
fc51a69ff1
commit
bc80944f26
@ -180,10 +180,13 @@ func (s *database) GetPrivateMessageByGlobalID(id int32) (*db.StoredPrivateMessa
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *database) GetGuildChannelMessageByID(id string) (*db.StoredGuildChannelMessage, error) {
|
func (s *database) GetGuildChannelMessageByID(id string) (*db.StoredGuildChannelMessage, error) {
|
||||||
_, err := base64.StdEncoding.DecodeString(id)
|
b, err := base64.StdEncoding.DecodeString(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "query invalid id error")
|
return nil, errors.Wrap(err, "query invalid id error")
|
||||||
}
|
}
|
||||||
|
if len(b) < 25 {
|
||||||
|
return nil, errors.New("query invalid id error: content too short")
|
||||||
|
}
|
||||||
var ret db.StoredGuildChannelMessage
|
var ret db.StoredGuildChannelMessage
|
||||||
var guildmsg StoredGuildChannelMessage
|
var guildmsg StoredGuildChannelMessage
|
||||||
s.RLock()
|
s.RLock()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user