Commit b5a7ff42 authored by Simon Kelley's avatar Simon Kelley

Check length of synth-domain prefix.

parent 48fd1c4d
...@@ -279,12 +279,12 @@ HAVE_SOCKADDR_SA_LEN ...@@ -279,12 +279,12 @@ HAVE_SOCKADDR_SA_LEN
#if defined(INET6_ADDRSTRLEN) && defined(IPV6_V6ONLY) #if defined(INET6_ADDRSTRLEN) && defined(IPV6_V6ONLY)
# define HAVE_IPV6 # define HAVE_IPV6
# define ADDRSTRLEN INET6_ADDRSTRLEN # define ADDRSTRLEN INET6_ADDRSTRLEN
#elif defined(INET_ADDRSTRLEN)
# undef HAVE_IPV6
# define ADDRSTRLEN INET_ADDRSTRLEN
#else #else
# if !defined(INET_ADDRSTRLEN)
# define INET_ADDRSTRLEN 16 /* 4*3 + 3 dots + NULL */
# endif
# undef HAVE_IPV6 # undef HAVE_IPV6
# define ADDRSTRLEN 16 /* 4*3 + 3 dots + NULL */ # define ADDRSTRLEN INET_ADDRSTRLEN
#endif #endif
......
...@@ -1726,7 +1726,11 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma ...@@ -1726,7 +1726,11 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
if (arg) if (arg)
{ {
if (option != 's') if (option != 's')
new->prefix = canonicalise_opt(arg); {
if (!(new->prefix = canonicalise_opt(arg)) ||
strlen(new->prefix) > MAXLABEL - INET_ADDRSTRLEN)
ret_err(_("bad prefix"));
}
else if (strcmp(arg, "local") != 0 || else if (strcmp(arg, "local") != 0 ||
(msize != 8 && msize != 16 && msize != 24)) (msize != 8 && msize != 16 && msize != 24))
ret_err(gen_err); ret_err(gen_err);
...@@ -1783,7 +1787,11 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma ...@@ -1783,7 +1787,11 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
else if (arg) else if (arg)
{ {
if (option != 's') if (option != 's')
new->prefix = canonicalise_opt(arg); {
if (!(new->prefix = canonicalise_opt(arg)) ||
strlen(new->prefix) > MAXLABEL - INET6_ADDRSTRLEN)
ret_err(_("bad prefix"));
}
else if (strcmp(arg, "local") != 0 || ((msize & 4) != 0)) else if (strcmp(arg, "local") != 0 || ((msize & 4) != 0))
ret_err(gen_err); ret_err(gen_err);
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment