mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-04 19:17:37 +08:00
fix: possible sql inject
This commit is contained in:
parent
cee4bccf45
commit
fc51a69ff1
@ -4,6 +4,7 @@
|
|||||||
package sqlite3
|
package sqlite3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"hash/crc64"
|
"hash/crc64"
|
||||||
"os"
|
"os"
|
||||||
@ -179,10 +180,14 @@ 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)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "query invalid id error")
|
||||||
|
}
|
||||||
var ret db.StoredGuildChannelMessage
|
var ret db.StoredGuildChannelMessage
|
||||||
var guildmsg StoredGuildChannelMessage
|
var guildmsg StoredGuildChannelMessage
|
||||||
s.RLock()
|
s.RLock()
|
||||||
err := s.db.Find(Sqlite3GuildChannelMessageTableName, &guildmsg, "WHERE ID='"+id+"'")
|
err = s.db.Find(Sqlite3GuildChannelMessageTableName, &guildmsg, "WHERE ID='"+id+"'")
|
||||||
s.RUnlock()
|
s.RUnlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "query error")
|
return nil, errors.Wrap(err, "query error")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user