Author: melifaro
Date: Thu Feb  5 14:54:53 2015
New Revision: 278264
URL: https://svnweb.freebsd.org/changeset/base/278264

Log:
  Fix IP_FW_NAT44_LIST_NAT size calculation.
  
  Found by:     lev
  Sponsored by: Yandex LLC

Modified:
  head/sys/netpfil/ipfw/ip_fw_nat.c

Modified: head/sys/netpfil/ipfw/ip_fw_nat.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_nat.c   Thu Feb  5 14:12:05 2015        
(r278263)
+++ head/sys/netpfil/ipfw/ip_fw_nat.c   Thu Feb  5 14:54:53 2015        
(r278264)
@@ -691,7 +691,7 @@ nat44_get_cfg(struct ip_fw_chain *chain,
        export_nat_cfg(ptr, ucfg);
        
        /* Estimate memory amount */
-       sz = sizeof(struct nat44_cfg_nat);
+       sz = sizeof(ipfw_obj_header) + sizeof(struct nat44_cfg_nat);
        LIST_FOREACH(r, &ptr->redir_chain, _next) {
                sz += sizeof(struct nat44_cfg_redir);
                LIST_FOREACH(s, &r->spool_chain, _next)
@@ -699,7 +699,7 @@ nat44_get_cfg(struct ip_fw_chain *chain,
        }
 
        ucfg->size = sz;
-       if (sd->valsize < sz + sizeof(*oh)) {
+       if (sd->valsize < sz) {
 
                /*
                 * Submitted buffer size is not enough.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to