the BACKWARD COMPTIBLITY code for the input for netstat leads to a
crash
Li yonggang
leeygang at gmail.com
Tue Jan 6 08:41:06 PST 2009
Hi,
I use FreeBSD 7.0-Release and find if a mistake input for -m can
make netstat crash. such as:
netstat -m xxx
After simple investigation, I found it is caused by the code in main.c :456
#define BACKWARD_COMPATIBILITY
#ifdef BACKWARD_COMPATIBILITY
if (*argv) {
if (isdigit(**argv)) {
interval = atoi(*argv);
if (interval <= 0)
usage();
++argv;
iflag = 1;
}
if (*argv) {
nlistf = *argv;
if (*++argv)
memf = *argv;
}
}
#endif
if the input is incorrect, this piece of code will set nlistf as a
incorrect string, this will make the live var set incorrectly. so I
think there are 2 ways to resolve:
1. add input check code in case -m of switch.
2. or delete backward comptiblity code.
Is my understanding correct?
Thanks,
Yong-gang Li.
More information about the freebsd-net
mailing list