diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index a4c8a8a731ce..a0fc3b85c19f 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -2530,7 +2530,7 @@ ipfw_show_config(struct cmdline_opts *co, struct format_opts *fo, 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, struct format_opts *fo, 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, struct format_opts *fo, /* 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, struct format_opts *fo, 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 */