summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-04-01 01:35:52 +0000
committerpfg <pfg@FreeBSD.org>2016-04-01 01:35:52 +0000
commit62128aa2ae8a6f43c5f586c99e7a5c1897a4f12e (patch)
tree22703ebf8a04e1084e6cfbd75817282470653caa
parentf447eee830eb76236e4bfa7d1ab93e5577047bcb (diff)
downloadFreeBSD-src-62128aa2ae8a6f43c5f586c99e7a5c1897a4f12e.zip
FreeBSD-src-62128aa2ae8a6f43c5f586c99e7a5c1897a4f12e.tar.gz
mtest: Prevent access to uninitialized value.
case 'g' makes use of value n, which is initialized for case 'b' and passe through to case 'g'. If case 'g' is called directly value 'n' is not initialized. Avoid the issue by initializing n before entering the switch. CID: 1006375 Reviewed by: bms
-rw-r--r--usr.sbin/mtest/mtest.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/mtest/mtest.c b/usr.sbin/mtest/mtest.c
index a28fab7..af522e2 100644
--- a/usr.sbin/mtest/mtest.c
+++ b/usr.sbin/mtest/mtest.c
@@ -396,6 +396,7 @@ process_cmd(char *cmd, int s, int s6, FILE *fp __unused)
while (isblank(*++line))
; /* Skip whitespace. */
+ n = 0;
switch (*cmd) {
case '?':
usage();
@@ -611,7 +612,6 @@ process_cmd(char *cmd, int s, int s6, FILE *fp __unused)
}
/* First determine our current filter mode. */
- n = 0;
if (getsourcefilter(af2sock(af, s, s6), ifindex,
&su.sa, su.sa.sa_len, &fmode, &n, NULL) != 0) {
warn("getsourcefilter");
OpenPOWER on IntegriCloud