bin/130300: netstat crash when params is incorrect

Li yonggang leeygang at gmail.com
Thu Jan 8 06:37:09 PST 2009


correct the patch files:).

On 1/8/09, FreeBSD-gnats-submit at freebsd.org
<FreeBSD-gnats-submit at freebsd.org> wrote:
> Thank you very much for your problem report.
> It has the internal identification `bin/130300'.
> The individual assigned to look at your
> report is: freebsd-bugs.
>
> You can access the state of your problem report at any time
> via this link:
>
> http://www.freebsd.org/cgi/query-pr.cgi?pr=130300
>
>>Category:       bin
>>Responsible:    freebsd-bugs
>>Synopsis:       netstat crash when params is incorrect
>>Arrival-Date:   Thu Jan 08 13:20:02 UTC 2009
>
-------------- next part --------------
*** main.c	Tue Jan  6 15:01:25 2009
--- ../main.c	Thu Jan  8 13:57:38 2009
***************
*** 341,346 ****
--- 341,347 ----
  int	af;		/* address family */
  int	live;		/* true if we are examining a live system */
  
+ 
  int
  main(int argc, char *argv[])
  {
***************
*** 463,489 ****
  		default:
  			usage();
  		}
! 	argv += optind;
! 	argc -= optind;
! 
! #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
! 
  	/*
  	 * Discard setgid privileges if not the running kernel so that bad
  	 * guys can't print interesting stuff from kernel memory.
--- 464,474 ----
  		default:
  			usage();
  		}
!     /*
!      * Params should be parsed without error.
!      * */
!     if(*(argv += optind))
!         usage();
  	/*
  	 * Discard setgid privileges if not the running kernel so that bad
  	 * guys can't print interesting stuff from kernel memory.


More information about the freebsd-bugs mailing list