aboutsummaryrefslogtreecommitdiff
path: root/sbin/ipfw
diff options
context:
space:
mode:
authorAndrey V. Elsukov <ae@FreeBSD.org>2020-08-05 11:26:49 +0000
committerAndrey V. Elsukov <ae@FreeBSD.org>2020-08-05 11:26:49 +0000
commit2403d47744568f6ad99fc2e40d05c686a6f9010d (patch)
treedde993e26c9d1de2dc2842d93d3b72211e4e8c5a /sbin/ipfw
parentb9615c3c00bedbdb8b1fef8de750aca401088d8f (diff)
downloadsrc-2403d47744568f6ad99fc2e40d05c686a6f9010d.tar.gz
src-2403d47744568f6ad99fc2e40d05c686a6f9010d.zip
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
Notes
Notes: svn path=/head/; revision=363904
Diffstat (limited to 'sbin/ipfw')
-rw-r--r--sbin/ipfw/nat64clat.c3
-rw-r--r--sbin/ipfw/nat64stl.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/sbin/ipfw/nat64clat.c b/sbin/ipfw/nat64clat.c
index 081d199bd59d..962fe7064f8d 100644
--- a/sbin/ipfw/nat64clat.c
+++ b/sbin/ipfw/nat64clat.c
@@ -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);
diff --git a/sbin/ipfw/nat64stl.c b/sbin/ipfw/nat64stl.c
index 44e0cbafbf3e..e82ec202b5c6 100644
--- a/sbin/ipfw/nat64stl.c
+++ b/sbin/ipfw/nat64stl.c
@@ -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);