NETSTAT(1): Avoid use of uninitialized memory

This commit is contained in:
Sebastian Huber
2015-11-18 09:47:10 +01:00
parent cf9836e322
commit 1061324396
4 changed files with 45 additions and 1 deletions

View File

@@ -387,6 +387,9 @@ int rtems_bsd_command_netstat(int argc, char *argv[])
rtems_bsd_program_lock();
nlistf = NULL;
memf = NULL;
Aflag = 0;
aflag = 0;
Bflag = 0;

View File

@@ -116,7 +116,8 @@ mbpr(void *kvmd, u_long mbaddr)
goto out;
}
#else /* __rtems__ */
;
warnx("mbpr: not implemented");
goto out;
#endif /* __rtems__ */
}

View File

@@ -231,7 +231,14 @@ mroutepr(u_long pmfchashtbl, u_long pmfctablesize, u_long pviftbl)
return;
}
} else
#ifndef __rtems__
kread(pviftbl, (char *)viftable, sizeof(viftable));
#else /* __rtems__ */
{
warnx("mroutepr: not implemented");
return;
}
#endif /* __rtems__ */
banner_printed = 0;
for (vifi = 0, v = viftable; vifi < MAXVIFS; ++vifi, ++v) {
@@ -302,6 +309,7 @@ mroutepr(u_long pmfchashtbl, u_long pmfctablesize, u_long pviftbl)
free(mfctable);
} else {
#ifndef __rtems__
LIST_HEAD(, mfc) *mfchashtbl;
u_long i, mfctablesize;
struct mfc mfc;
@@ -330,6 +338,10 @@ mroutepr(u_long pmfchashtbl, u_long pmfctablesize, u_long pviftbl)
}
free(mfchashtbl);
#else /* __rtems__ */
warnx("mroutepr: not implemented");
return;
#endif /* __rtems__ */
}
if (!banner_printed)
@@ -352,7 +364,14 @@ mrt_stats(u_long mstaddr)
return;
}
} else
#ifndef __rtems__
kread(mstaddr, (char *)&mrtstat, sizeof(mrtstat));
#else /* __rtems__ */
{
warnx("mrt_stats: not implemented");
return;
}
#endif /* __rtems__ */
printf("IPv4 multicast forwarding:\n");

View File

@@ -124,7 +124,14 @@ mroute6pr(u_long mfcaddr, u_long mifaddr)
return;
}
} else
#ifndef __rtems__
kread(mifaddr, (char *)mif6table, sizeof(mif6table));
#else /* __rtems__ */
{
warnx("mroute6pr: not implemented");
return;
}
#endif /* __rtems__ */
saved_numeric_addr = numeric_addr;
numeric_addr = 1;
@@ -167,7 +174,14 @@ mroute6pr(u_long mfcaddr, u_long mifaddr)
return;
}
} else
#ifndef __rtems__
kread(mfcaddr, (char *)mf6ctable, sizeof(mf6ctable));
#else /* __rtems__ */
{
warnx("mroute6pr: not implemented");
return;
}
#endif /* __rtems__ */
banner_printed = 0;
@@ -231,7 +245,14 @@ mrt6_stats(u_long mstaddr)
return;
}
} else
#ifndef __rtems__
kread(mstaddr, (char *)&mrtstat, sizeof(mrtstat));
#else /* __rtems__ */
{
warnx("mrt6_stats: not implemented");
return;
}
#endif /* __rtems__ */
printf("IPv6 multicast forwarding:\n");