"xargs" dereferences null pointers
Guy Harris
guy at sun.uucp
Sat Aug 31 10:16:13 AEST 1985
It scans the argument list for flag arguments under the assumption that
the null pointer at the end of the argument list points to a string which
doesn't begin with a "-". Sloppy, guys; a null pointer doesn't point to
*anything*, especially on a Sun...
*** /arch/s5r2/usr/src/cmd/xargs.c Wed Jun 15 19:15:26 1983
--- ./xargs.c Thu Aug 29 15:01:19 1985
***************
*** 55,61
/* look for flag arguments */
! while ( (*argv)[0] == '-' ) {
flagval = *argv+1;
switch ( *flagval++ ) {
case 'x': DASHX = LEGAL = TRUE;
--- 55,61 -----
/* look for flag arguments */
! while ( argc != 0 && (*argv)[0] == '-' ) {
flagval = *argv+1;
switch ( *flagval++ ) {
case 'x': DASHX = LEGAL = TRUE;
***************
*** 104,110
break;
}
argv++;
! if ( --argc < 1 ) break;
}
if( ! OK )
ERR = TRUE;
--- 104,110 -----
break;
}
argv++;
! argc--;
}
if( ! OK )
ERR = TRUE;
More information about the Net.bugs.usg
mailing list