Kaynağa Gözat

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 2 yıl önce
ebeveyn
işleme
abfb8442ab
1 değiştirilmiş dosya ile 1 ekleme ve 5 silme
  1. 1
    5
      irc/modes.go

+ 1
- 5
irc/modes.go Dosyayı Görüntüle

@@ -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…
İptal
Kaydet