Author: melifaro
Date: Sun Apr 19 12:49:30 2015
New Revision: 281740
URL: https://svnweb.freebsd.org/changeset/base/281740

Log:
  Fix use-after-free.
  
  Reported by:  Coverity Scan, pfg
  CID:          1245747

Modified:
  head/sbin/ipfw/nat.c

Modified: head/sbin/ipfw/nat.c
==============================================================================
--- head/sbin/ipfw/nat.c        Sun Apr 19 12:11:07 2015        (r281739)
+++ head/sbin/ipfw/nat.c        Sun Apr 19 12:49:30 2015        (r281740)
@@ -1008,11 +1008,10 @@ nat_foreach(nat_cb_t *f, void *arg, int 
 
                olh->size = sz;
                if (do_get3(IP_FW_NAT44_LIST_NAT, &olh->opheader, &sz) != 0) {
+                       sz = olh->size;
                        free(olh);
-                       if (errno == ENOMEM) {
-                               sz = olh->size;
+                       if (errno == ENOMEM)
                                continue;
-                       }
                        return (errno);
                }
 
_______________________________________________
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