svn commit: r272818 - projects/ipfw/sbin/ipfw

Alexander V. Chernikov melifaro at FreeBSD.org
Thu Oct 9 12:54:57 UTC 2014


Author: melifaro
Date: Thu Oct  9 12:54:56 2014
New Revision: 272818
URL: https://svnweb.freebsd.org/changeset/base/272818

Log:
  * Fix use-after-free in table printing code.
  * Fix showing human-readable error in table cmds code.

Modified:
  projects/ipfw/sbin/ipfw/tables.c

Modified: projects/ipfw/sbin/ipfw/tables.c
==============================================================================
--- projects/ipfw/sbin/ipfw/tables.c	Thu Oct  9 12:37:53 2014	(r272817)
+++ projects/ipfw/sbin/ipfw/tables.c	Thu Oct  9 12:54:56 2014	(r272818)
@@ -1018,6 +1018,8 @@ table_modify_record(ipfw_obj_header *oh,
 
 	if (error == 0)
 		return;
+	/* Get real OS error */
+	error = errno;
 
 	/* Try to provide more human-readable error */
 	switch (error) {
@@ -1551,12 +1553,11 @@ tables_foreach(table_cb_t *f, void *arg,
 
 		olh->size = sz;
 		if (do_get3(IP_FW_TABLES_XLIST, &olh->opheader, &sz) != 0) {
+			sz = olh->size;
 			free(olh);
-			if (errno == ENOMEM) {
-				sz = olh->size;
-				continue;
-			}
-			return (errno);
+			if (errno != ENOMEM)
+				return (errno);
+			continue;
 		}
 
 		if (sort != 0)


More information about the svn-src-projects mailing list