Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jan 2009 16:12:46 +0000
From:      "Li yonggang" <leeygang@gmail.com>
To:        freebsd-net@freebsd.org
Subject:   the BACKWARD COMPTIBLITY code for the input for netstat leads to a crash
Message-ID:  <6742fb710901060812u5f1b749cubec97c8adbbe3384@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6742fb710901060812u5f1b749cubec97c8adbbe3384>