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