From d326d1bc8bc1d9246e70a09c7d2861e69f95f471 Mon Sep 17 00:00:00 2001
From: Simon Zolin <s.zolin@adguard.com>
Date: Wed, 17 Apr 2019 12:40:27 +0300
Subject: [PATCH] * control: /install/configure: validate port number

---
 control.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/control.go b/control.go
index 2207edde..3dca2c36 100644
--- a/control.go
+++ b/control.go
@@ -1157,6 +1157,11 @@ func handleInstallConfigure(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
+	if newSettings.Web.Port == 0 || newSettings.DNS.Port == 0 {
+		httpError(w, http.StatusBadRequest, "port value can't be 0")
+		return
+	}
+
 	restartHTTP := true
 	if config.BindHost == newSettings.Web.IP && config.BindPort == newSettings.Web.Port {
 		// no need to rebind