Date: Sat, 18 Oct 2014 15:18:31 +0000 (UTC) From: "Alexander V. Chernikov" <melifaro@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273253 - head/sbin/ipfw Message-ID: <201410181518.s9IFIVYM094601@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: melifaro Date: Sat Oct 18 15:18:31 2014 New Revision: 273253 URL: https://svnweb.freebsd.org/changeset/base/273253 Log: * Zero rule buffer. * Rename 'read' variable. Pointed by: luigi Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Sat Oct 18 15:11:13 2014 (r273252) +++ head/sbin/ipfw/ipfw2.c Sat Oct 18 15:18:31 2014 (r273253) @@ -2530,7 +2530,7 @@ ipfw_show_config(struct cmdline_opts *co int lac; char **lav; char *endptr; - size_t read; + size_t readsz; struct buf_pr bp; ipfw_obj_ctlv *ctlv, *tstate; ipfw_obj_tlv *rbase; @@ -2542,7 +2542,7 @@ ipfw_show_config(struct cmdline_opts *co rbase = NULL; dynbase = NULL; dynsz = 0; - read = sizeof(*cfg); + readsz = sizeof(*cfg); rcnt = 0; fo->set_mask = cfg->set_mask; @@ -2553,7 +2553,7 @@ ipfw_show_config(struct cmdline_opts *co /* We've requested static rules */ if (ctlv->head.type == IPFW_TLV_TBLNAME_LIST) { fo->tstate = ctlv; - read += ctlv->head.length; + readsz += ctlv->head.length; ctlv = (ipfw_obj_ctlv *)((caddr_t)ctlv + ctlv->head.length); } @@ -2561,15 +2561,15 @@ ipfw_show_config(struct cmdline_opts *co if (ctlv->head.type == IPFW_TLV_RULE_LIST) { rbase = (ipfw_obj_tlv *)(ctlv + 1); rcnt = ctlv->count; - read += ctlv->head.length; + readsz += ctlv->head.length; ctlv = (ipfw_obj_ctlv *)((caddr_t)ctlv + ctlv->head.length); } } - if ((cfg->flags & IPFW_CFG_GET_STATES) && (read != sz)) { + if ((cfg->flags & IPFW_CFG_GET_STATES) && (readsz != sz)) { /* We may have some dynamic states */ - dynsz = sz - read; + dynsz = sz - readsz; /* Skip empty header */ if (dynsz != sizeof(ipfw_obj_ctlv)) dynbase = (caddr_t)ctlv; @@ -4686,6 +4686,7 @@ ipfw_add(char *av[]) ipfw_obj_ctlv *ctlv, *tstate; rbufsize = sizeof(rulebuf); + memset(rulebuf, 0, rbufsize); memset(&ts, 0, sizeof(ts)); /* Optimize case with no tables */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410181518.s9IFIVYM094601>