[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rm hack



On 2001-10-08 at 23:10 +0000, Alex Kirk wrote:
> > 		case 'o':
> > 			Pflag = 1;
> > 			owrite = strtol(optarg, &endptr, 10);

In strtol(3):

 The string may begin with an arbitrary amount of whitespace (as deter-
 mined by isspace(3)) followed by a single optional `+' or `-' sign.

> > 	if (owrite == NULL)
> > 		y = 2;
> > 	else
> > 		y = (owrite - 1);

So "-o 0" is certainly interesting, regardless of whether or not "-o -1"
is parsed as two options or an option and an argument.  Certainly:
$ rm -o ' -1' -P ...
would get you (owrite == -1)

> > 	for (z = 0; z < y; z++)

Blam.  At this point, you're waiting a while.

(Please note: I'm not commenting on whether or not the patch is good or
 bad, I'm not getting at anyone, I'm simply pointing to what is an issue
 here </pre-emptive-antiflame>).
--
Science without religion is lame; religion without science is blind.
 -- Albert Einstein, Reader's Digest, Nov. 1973

[demime 0.98d removed an attachment of type application/pgp-signature]