downstream: reject negative or zero network IDs in parseBouncerNetID

This commit is contained in:
Simon Ser 2022-03-21 15:00:30 +01:00
parent d9468b983f
commit 2c691d012d

View file

@ -91,7 +91,7 @@ func newInvalidUsernameOrPasswordError(err error) error {
func parseBouncerNetID(subcommand, s string) (int64, error) { func parseBouncerNetID(subcommand, s string) (int64, error) {
id, err := strconv.ParseInt(s, 10, 64) id, err := strconv.ParseInt(s, 10, 64)
if err != nil { if err != nil || id <= 0 {
return 0, ircError{&irc.Message{ return 0, ircError{&irc.Message{
Command: "FAIL", Command: "FAIL",
Params: []string{"BOUNCER", "INVALID_NETID", subcommand, s, "Invalid network ID"}, Params: []string{"BOUNCER", "INVALID_NETID", subcommand, s, "Invalid network ID"},