diff options
author | melifaro <melifaro@FreeBSD.org> | 2014-10-18 15:18:31 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2014-10-18 15:18:31 +0000 |
commit | d7ea66893ffd70df675df8ebd11c04d63611a773 (patch) | |
tree | 6a97229cd5380ed32d0b7153109450ddd6225b87 /sbin | |
parent | 9bb1f4bbbc856f6ec17cd393451661f31f8ca5d2 (diff) | |
download | FreeBSD-src-d7ea66893ffd70df675df8ebd11c04d63611a773.zip FreeBSD-src-d7ea66893ffd70df675df8ebd11c04d63611a773.tar.gz |
* Zero rule buffer.
* Rename 'read' variable.
Pointed by: luigi
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ipfw/ipfw2.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index a4c8a8a..a0fc3b8 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 */ |