summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2014-10-09 12:54:56 +0000
committermelifaro <melifaro@FreeBSD.org>2014-10-09 12:54:56 +0000
commit7740b8f739bab35cbac5df19dcd10efc186fc379 (patch)
treed27b795dba310e58808ca23f13e7a3f70ce3042a /sbin
parent66120268e5b26fa64d3373afac0b5b83a530915b (diff)
downloadFreeBSD-src-7740b8f739bab35cbac5df19dcd10efc186fc379.zip
FreeBSD-src-7740b8f739bab35cbac5df19dcd10efc186fc379.tar.gz
* Fix use-after-free in table printing code.
* Fix showing human-readable error in table cmds code.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ipfw/tables.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c
index 9e6d49a..a94e182 100644
--- a/sbin/ipfw/tables.c
+++ b/sbin/ipfw/tables.c
@@ -1018,6 +1018,8 @@ table_modify_record(ipfw_obj_header *oh, int ac, char *av[], int add,
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, int sort)
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)
OpenPOWER on IntegriCloud