service: limit number of -connect-command flags

This commit is contained in:
Simon Ser 2022-03-14 19:37:12 +01:00
parent 35b09f069c
commit c7039da54b

View File

@ -481,6 +481,9 @@ func (fs *networkFlagSet) update(network *Network) error {
if len(fs.ConnectCommands) == 1 && fs.ConnectCommands[0] == "" { if len(fs.ConnectCommands) == 1 && fs.ConnectCommands[0] == "" {
network.ConnectCommands = nil network.ConnectCommands = nil
} else { } else {
if len(fs.ConnectCommands) > 20 {
return fmt.Errorf("too many -connect-command flags supplied")
}
for _, command := range fs.ConnectCommands { for _, command := range fs.ConnectCommands {
_, err := irc.ParseMessage(command) _, err := irc.ParseMessage(command)
if err != nil { if err != nil {