bbf61da
diff -up openssh/misc.c.config openssh/misc.c
bbf61da
--- openssh/misc.c.config	2018-08-22 13:58:54.922807799 +0200
bbf61da
+++ openssh/misc.c	2018-08-22 13:58:55.000808428 +0200
bbf61da
@@ -485,7 +485,7 @@ put_host_port(const char *host, u_short
3cd4899
  * The delimiter char, if present, is stored in delim.
3cd4899
  * If this is the last field, *cp is set to NULL.
3cd4899
  */
3cd4899
-static char *
3cd4899
+char *
3cd4899
 hpdelim2(char **cp, char *delim)
3cd4899
 {
3cd4899
 	char *s, *old;
bbf61da
diff -up openssh/misc.h.config openssh/misc.h
bbf61da
--- openssh/misc.h.config	2018-08-20 07:57:29.000000000 +0200
bbf61da
+++ openssh/misc.h	2018-08-22 13:58:55.001808436 +0200
3cd4899
@@ -54,6 +54,7 @@ int	 set_rdomain(int, const char *);
3cd4899
 int	 a2port(const char *);
3cd4899
 int	 a2tun(const char *, int *);
3cd4899
 char	*put_host_port(const char *, u_short);
3cd4899
+char	*hpdelim2(char **, char *);
3cd4899
 char	*hpdelim(char **);
3cd4899
 char	*cleanhostname(char *);
3cd4899
 char	*colon(char *);
bbf61da
diff -up openssh/servconf.c.config openssh/servconf.c
bbf61da
--- openssh/servconf.c.config	2018-08-22 13:58:54.989808340 +0200
bbf61da
+++ openssh/servconf.c	2018-08-22 14:18:49.235443937 +0200
bbf61da
@@ -886,7 +886,7 @@ process_permitopen_list(struct ssh *ssh,
3cd4899
 {
3cd4899
 	u_int i;
3cd4899
 	int port;
3cd4899
-	char *host, *arg, *oarg;
3cd4899
+	char *host, *arg, *oarg, ch;
bbf61da
 	int where = opcode == sPermitOpen ? FORWARD_LOCAL : FORWARD_REMOTE;
bbf61da
 	const char *what = lookup_opcode_name(opcode);
b9d68e7
 
bbf61da
@@ -904,8 +904,8 @@ process_permitopen_list(struct ssh *ssh,
3cd4899
 	/* Otherwise treat it as a list of permitted host:port */
bbf61da
 	for (i = 0; i < num_opens; i++) {
bbf61da
 		oarg = arg = xstrdup(opens[i]);
3cd4899
-		host = hpdelim(&arg;;
3cd4899
-		if (host == NULL)
3cd4899
+		host = hpdelim2(&arg, &ch);
3cd4899
+		if (host == NULL || ch == '/')
bbf61da
 			fatal("%s: missing host in %s", __func__, what);
3cd4899
 		host = cleanhostname(host);
3cd4899
 		if (arg == NULL || ((port = permitopen_port(arg)) < 0))
bbf61da
@@ -1323,8 +1323,10 @@ process_server_config_line(ServerOptions
3cd4899
 			port = 0;
3cd4899
 			p = arg;
3cd4899
 		} else {
3cd4899
-			p = hpdelim(&arg;;
3cd4899
-			if (p == NULL)
3cd4899
+			char ch;
3cd4899
+			arg2 = NULL;
3cd4899
+			p = hpdelim2(&arg, &ch);
3cd4899
+			if (p == NULL || ch == '/')
3cd4899
 				fatal("%s line %d: bad address:port usage",
3cd4899
 				    filename, linenum);
3cd4899
 			p = cleanhostname(p);
bbf61da
@@ -1965,9 +1967,10 @@ process_server_config_line(ServerOptions
bbf61da
 				 */
bbf61da
 				xasprintf(&arg2, "*:%s", arg);
bbf61da
 			} else {
bbf61da
+				char ch;
bbf61da
 				arg2 = xstrdup(arg);
bbf61da
-				p = hpdelim(&arg;;
bbf61da
-				if (p == NULL) {
bbf61da
+				p = hpdelim2(&arg, &ch);
bbf61da
+				if (p == NULL || ch == '/') {
bbf61da
 					fatal("%s line %d: missing host in %s",
bbf61da
 					    filename, linenum,
bbf61da
 					    lookup_opcode_name(opcode));