1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-15 17:46:55 +00:00

Treat all strings from read buffers as gc-tainted

Rule: Copies must be made before retaining the string.
This commit is contained in:
Kane York 2016-01-17 19:46:01 -08:00
parent fdbcfe98dd
commit 43ecbff656
6 changed files with 37 additions and 17 deletions

View file

@ -61,6 +61,8 @@ var Configuration *ConfigFile
var janitorsOnce sync.Once
var CommandPool *StringPool
var PubSubChannelPool *StringPool
var TwitchChannelPool *StringPool
// SetupServerAndHandle starts all background goroutines and registers HTTP listeners on the given ServeMux.
// Essentially, this function completely preps the server for a http.ListenAndServe call.
@ -115,7 +117,7 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
}
func init() {
internCommands()
setupInterning()
}
// startJanitors starts the 'is_init_func' goroutines
@ -514,11 +516,11 @@ func UnmarshalClientMessage(data []byte, payloadType int, v interface{}) (err er
spaceIdx = strings.IndexRune(dataStr, ' ')
if spaceIdx == -1 {
out.Command = CommandPool.Intern(dataStr)
out.Command = CommandPool.InternCommand(dataStr)
out.Arguments = nil
return nil
} else {
out.Command = CommandPool.Intern(dataStr[:spaceIdx])
out.Command = CommandPool.InternCommand(dataStr[:spaceIdx])
}
dataStr = dataStr[spaceIdx+1:]
argumentsJSON := string([]byte(dataStr))