Преглед изворни кода

Merge pull request #246 from rod-hynes/master

Validate protocol names in config.TunnelProtocolPorts
Rod Hynes пре 9 година
родитељ
комит
57eed955ba
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      psiphon/server/config.go

+ 3 - 0
psiphon/server/config.go

@@ -244,6 +244,9 @@ func LoadConfig(configJSON []byte) (*Config, error) {
 	}
 
 	for tunnelProtocol, _ := range config.TunnelProtocolPorts {
+		if !common.Contains(common.SupportedTunnelProtocols, tunnelProtocol) {
+			return nil, fmt.Errorf("Unsupported tunnel protocol: %s", tunnelProtocol)
+		}
 		if common.TunnelProtocolUsesSSH(tunnelProtocol) ||
 			common.TunnelProtocolUsesObfuscatedSSH(tunnelProtocol) {
 			if config.SSHPrivateKey == "" || config.SSHServerVersion == "" ||