Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Aug 2020 11:26:49 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363904 - head/sbin/ipfw
Message-ID:  <202008051126.075BQnMi085384@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Wed Aug  5 11:26:49 2020
New Revision: 363904
URL: https://svnweb.freebsd.org/changeset/base/363904

Log:
  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

Modified:
  head/sbin/ipfw/nat64clat.c
  head/sbin/ipfw/nat64stl.c

Modified: head/sbin/ipfw/nat64clat.c
==============================================================================
--- head/sbin/ipfw/nat64clat.c	Wed Aug  5 11:26:14 2020	(r363903)
+++ head/sbin/ipfw/nat64clat.c	Wed Aug  5 11:26:49 2020	(r363904)
@@ -303,6 +303,9 @@ nat64clat_config(const char *name, uint8_t set, int ac
 
 			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);

Modified: head/sbin/ipfw/nat64stl.c
==============================================================================
--- head/sbin/ipfw/nat64stl.c	Wed Aug  5 11:26:14 2020	(r363903)
+++ head/sbin/ipfw/nat64stl.c	Wed Aug  5 11:26:49 2020	(r363904)
@@ -249,6 +249,9 @@ nat64stl_create(const char *name, uint8_t set, int ac,
 			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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008051126.075BQnMi085384>