Explorar el Código

fix handling of +k with an empty key parameter

This should be disallowed; `MODE #keytest +k :` should just be an error.
tags/v2.8.0-rc1
Shivaram Lingamneni hace 2 años
padre
commit
abfb8442ab
Se han modificado 1 ficheros con 1 adiciones y 5 borrados
  1. 1
    5
      irc/modes.go

+ 1
- 5
irc/modes.go Ver fichero

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

Loading…
Cancelar
Guardar