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);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to