Re: [PATCH] More secure SYSRQ for xtables-addons

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

 



On Monday 2008-12-01 23:02, John Haxby wrote:
>>   
>> > +	for (i = 0; sysrq_password[i]; i++)
>> > +		if (sysrq_password[i] == '\n')
>> >     
>> +|| sysrq_password[i] == '\0'
>>
>> (assuming that echoing into string module parameters at least adds a \0)
>>   
> I think it does this anyway doesn't it?  The "sysrq_password[i]" loop test
> stops at the '\0'

Oh drats, I did not see that. That's why I prefer explicit zero tests
everywhere (except bools, because they are bools, and not
integers/pointers), e.g.

	for (i = 0; sysrq_password[i] != '\0'; ++i)

Also, \n could be simply tested for by adding it to the for condition:

	for (i = 0; sysrq_password[i] != '\0' &&
	     sysrq_password[i] != '\n'; ++i)
		/* loop */;

Turns out doing so saves 7 bytes on i586 ;-)
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux