3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-22 03:49:27 +01:00

fix handling of +k with an empty key parameter

This should be disallowed; `MODE #keytest +k :` should just be an error.
This commit is contained in:
Shivaram Lingamneni 2021-08-10 15:11:11 -04:00
parent bbb52bf692
commit abfb8442ab

View File

@ -148,11 +148,7 @@ func ParseDefaultUserModes(rawModes *string) modes.Modes {
// #1021: channel key must be valid as a non-final parameter
func validateChannelKey(key string) bool {
// empty string is valid in this context because it unsets the mode
if len(key) == 0 {
return true
}
return key[0] != ':' && strings.IndexByte(key, ' ') == -1
return key != "" && key[0] != ':' && strings.IndexByte(key, ' ') == -1
}
// ApplyChannelModeChanges applies a given set of mode changes.