From 08f58fe456854fcaf7f25e6c09971821dfe878f6 Mon Sep 17 00:00:00 2001 From: Luiz Otavio O Souza Date: Thu, 17 Nov 2016 19:02:25 +0000 Subject: [PATCH] Zero etherswitch_vlangroup structure before doing partial assignments. MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) --- sbin/etherswitchcfg/etherswitchcfg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sbin/etherswitchcfg/etherswitchcfg.c b/sbin/etherswitchcfg/etherswitchcfg.c index 2f9ccf9c6fe7..ee56ff9106d9 100644 --- a/sbin/etherswitchcfg/etherswitchcfg.c +++ b/sbin/etherswitchcfg/etherswitchcfg.c @@ -308,7 +308,8 @@ set_vlangroup_vid(struct cfg *cfg, char *argv[]) { int v; etherswitch_vlangroup_t vg; - + + memset(&vg, 0, sizeof(vg)); v = strtol(argv[1], NULL, 0); if (v < 0 || v > IEEE802DOT1Q_VID_MAX) errx(EX_USAGE, "vlan must be between 0 and %d", IEEE802DOT1Q_VID_MAX); @@ -327,8 +328,9 @@ set_vlangroup_members(struct cfg *cfg, char *argv[]) int member, untagged; char *c, *d; int v; - + member = untagged = 0; + memset(&vg, 0, sizeof(vg)); if (strcmp(argv[1], "none") != 0) { for (c=argv[1]; *c; c=d) { v = strtol(c, &d, 0);