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.
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to