Przeglądaj źródła

Check secret length in mtg

tags/0.9
9seconds 8 lat temu
rodzic
commit
ec548e5779
1 zmienionych plików z 3 dodań i 0 usunięć
  1. 3
    0
      config/config.go

+ 3
- 0
config/config.go Wyświetl plik

@@ -87,6 +87,9 @@ func NewConfig(debug, verbose bool, // nolint: gocyclo
87 87
 	statsIP net.IP, statsPort uint16,
88 88
 	timeoutRead, timeoutWrite time.Duration,
89 89
 	secret string) (*Config, error) {
90
+	if len(secret) != 32 {
91
+		return nil, errors.New("Telegram demands secret of length 32")
92
+	}
90 93
 	secretBytes, err := hex.DecodeString(secret)
91 94
 	if err != nil {
92 95
 		return nil, errors.Annotate(err, "Cannot create config")

Ładowanie…
Anuluj
Zapisz