Date: Fri, 25 Aug 2006 23:57:34 +0400 From: Roman Kurakin <rik@inse.ru> To: Frederic Praca <frederic.praca@freebsd-fr.org> Cc: freebsd-hackers@freebsd.org Subject: Re: Latest patch for PPP Message-ID: <44EF562E.2040103@inse.ru> In-Reply-To: <20060825184613.3389e895@localhost.darkstar> References: <20060825184613.3389e895@localhost.darkstar>
index | next in thread | previous in thread | raw e-mail
Frederic Praca:
> Hello,
> in the latest security advisory for PPP, the patch deals with conditions
> in a for loop. The correct line is :
> for (rlen=0; len >= 2 && p[1] >= 2 && len >= p[1]; len-=p[1], p+=p[1]) {
>
> Couldn't the condition be simpler like :
> for (rlen=0; p[1] >= 2 && len >= p[1]; len-=p[1], p+=p[1]){
>
If len<2 you just can't access (theoretically) p[1] cause in best case
you have only p[0] (len=1)
or do not have even p[0] (len=0). So from general point of view this is
correct code.
rik
> Or is there a hack I didn't understand ?
> In this case, if p[1] is greater or equal than 2, if we ensure that len
>
>> = p[1], we don't have to test that it's greater or equal than 2, isn't
>> it ?
>>
>
> Fred
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44EF562E.2040103>
