From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1N7btV-0000mL-Lr for mharc-grub-devel@gnu.org; Mon, 09 Nov 2009 16:35:25 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N7btU-0000lK-0D for grub-devel@gnu.org; Mon, 09 Nov 2009 16:35:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N7btP-0000hp-1R for grub-devel@gnu.org; Mon, 09 Nov 2009 16:35:23 -0500 Received: from [199.232.76.173] (port=40943 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7btO-0000he-HZ for grub-devel@gnu.org; Mon, 09 Nov 2009 16:35:18 -0500 Received: from mail-ew0-f228.google.com ([209.85.219.228]:49053) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N7btN-0002Td-Jj for grub-devel@gnu.org; Mon, 09 Nov 2009 16:35:18 -0500 Received: by ewy28 with SMTP id 28so4686796ewy.42 for ; Mon, 09 Nov 2009 13:35:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type; bh=SyXYm1GKLPIGsXgf3lWJK/0MVB/psmh4AdusqLfSWic=; b=kzXG7EBGEEaSvls3U7ysaINBKmMI+Zh04iFnrDduInGwyfq26zh+IHMsBGlolSowGc FP5yeXU+G8lHSvS38I5vgeWZ3ijQq09WzZJWgK5hW1bBR4LfDr7FEruItkQRYdi3ZNVN BRWZmPdb3UIkli4g7yuh1q5riXDr1n+lNx5PY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; b=ZmRT40gJSXx4WCQwD5vHUztET8rIB0VJfepJwIAh8ornN+JriijpzHkhYuY7JmwKzh aU3ILVfl22wbkLD+3fMKKefV5q33GheGWaIpONlCnyDXeOOhgZ6m0rqebnSC7zDEGb28 rpbU+D64L9Z1W3LS7m/x7bHLWsvhm1hwVlsVU= Received: by 10.213.100.18 with SMTP id w18mr1771209ebn.60.1257802514806; Mon, 09 Nov 2009 13:35:14 -0800 (PST) Received: from debian.bg45.phnet (gprs01.swisscom-mobile.ch [193.247.250.1]) by mx.google.com with ESMTPS id 5sm244013eyh.2.2009.11.09.13.35.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 09 Nov 2009 13:35:14 -0800 (PST) Message-ID: <4AF88AEF.8010102@gmail.com> Date: Mon, 09 Nov 2009 22:34:39 +0100 From: Vladimir 'phcoder' Serbinenko User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090701) MIME-Version: 1.0 To: The development of GNU GRUB References: <20091109010422.GA23417@thorin> <4AF81E2C.2090700@gmail.com> <4AF82868.6090803@gmail.com> <4AF85568.7080105@duboucher.eu> <20091109181010.GA7372@thorin> <4AF85C54.3080302@gmail.com> <20091109182518.GA14767@thorin> <4AF86387.7090307@gmail.com> <4AF885EE.7000709@duboucher.eu> In-Reply-To: <4AF885EE.7000709@duboucher.eu> X-Enigmail-Version: 0.95.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig436FDB26418743B26BE56A51" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: Imminent bugfix release (1.97.1) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2009 21:35:24 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig436FDB26418743B26BE56A51 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Duboucher Thomas wrote: > Bean a =C3=A9crit : > > Hi, > > > This one work: > > > int > > auth_strcmp (const char *s1, const char *s2) > > { > > int result =3D 0; > > > while (1) > > { > > result +=3D (*s1 !=3D *s2); > > if (*s1 =3D=3D 0) > > break; > > > s1++; > > s2++; > > } > > > return (result !=3D 0); > > } > > > The trick is to compare the ending '\0' as well, so that partial matc= h > > is not satisfied. > > > Yep, I like this one, but I would prefer using an OR instead of an = ADD > (with a highly hypothetical integer overflow :p) and because it's nicer= > in terms of pure logic. > "The comparison beetwen s1 and s2 is false if *s1 is different from= > *s2, or recursively if the comparison beetwen s1+1 and s2+1 is false" > > int > auth_strcmp (const char *s1, const char *s2) > { > int ret =3D 0; > > for (;;) > { > ret |=3D (*s1 !=3D *s2); > > if (*s1 =3D=3D '\0') > break; > > s1++; > s2++; > } > > return ret; > } > But now it has a technical problem: it may read post array definitions. If any of post-array memory is MMIO or absent reading from it may have peculiar consequences > Also, because s1 and s2 have two differents roles, I think it would= be > best to give them names that better suits them. ;) > > Thomas. _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel --=20 Regards Vladimir 'phcoder' Serbinenko --------------enig436FDB26418743B26BE56A51 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iF4EAREKAAYFAkr4iw0ACgkQNak7dOguQgkA7QD/eWMJwVYDtf2xneURW0PZKW6b 0MexjjbuX/JpAGyeYzEA/1NIYfJs0Ckxz79AVw9Z1L4FHF2Z/VsoXBlmsyURuKan =42o9 -----END PGP SIGNATURE----- --------------enig436FDB26418743B26BE56A51--