Fix SIGSEGV in ipfw(8) when NAT64 prefix length is omitted.

Submitted by:	Evgeniy Khramtsov <evgeniy at khramtsov org>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25734
This commit is contained in:
Andrey V. Elsukov 2020-08-05 11:26:49 +00:00
parent b9615c3c00
commit 2403d47744
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363904
2 changed files with 6 additions and 0 deletions

View File

@ -303,6 +303,9 @@ nat64clat_config(const char *name, uint8_t set, int ac, char **av)
if ((p = strchr(*av, '/')) != NULL)
*p++ = '\0';
else
errx(EX_USAGE,
"Prefix length required: %s", *av);
if (inet_pton(AF_INET6, *av, &prefix) != 1)
errx(EX_USAGE,
"Bad prefix: %s", *av);

View File

@ -249,6 +249,9 @@ nat64stl_create(const char *name, uint8_t set, int ac, char *av[])
NEED1("IPv6 prefix6 required");
if ((p = strchr(*av, '/')) != NULL)
*p++ = '\0';
else
errx(EX_USAGE,
"Prefix length required: %s", *av);
if (inet_pton(AF_INET6, *av, &cfg->prefix6) != 1)
errx(EX_USAGE,
"Bad prefix: %s", *av);