From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 25 19:50:12 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 560F016A4DD for ; Fri, 25 Aug 2006 19:50:12 +0000 (UTC) (envelope-from rik@inse.ru) Received: from mail.inse.ru (inse.ru [144.206.128.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id D42EF43D45 for ; Fri, 25 Aug 2006 19:50:11 +0000 (GMT) (envelope-from rik@inse.ru) Received: from [127.0.0.1] (www.inse.ru [144.206.128.1]) by mail.inse.ru (Postfix) with ESMTP id 78F3B33C46; Fri, 25 Aug 2006 23:50:10 +0400 (MSD) Message-ID: <44EF562E.2040103@inse.ru> Date: Fri, 25 Aug 2006 23:57:34 +0400 From: Roman Kurakin User-Agent: Thunderbird 1.5 (X11/20060119) MIME-Version: 1.0 To: Frederic Praca References: <20060825184613.3389e895@localhost.darkstar> In-Reply-To: <20060825184613.3389e895@localhost.darkstar> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Latest patch for PPP X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2006 19:50:12 -0000 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" >