All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: Imminent bugfix release (1.97.1)
Date: Mon, 09 Nov 2009 22:34:39 +0100	[thread overview]
Message-ID: <4AF88AEF.8010102@gmail.com> (raw)
In-Reply-To: <4AF885EE.7000709@duboucher.eu>

[-- Attachment #1: Type: text/plain, Size: 1557 bytes --]

Duboucher Thomas wrote:
> Bean a écrit :
> > Hi,
>
> > This one work:
>
> > int
> > auth_strcmp (const char *s1, const char *s2)
> > {
> >   int result = 0;
>
> >   while (1)
> >     {
> >       result += (*s1 != *s2);
> >       if (*s1 == 0)
> >     break;
>
> >       s1++;
> >       s2++;
> >     }
>
> >   return (result != 0);
> > }
>
> > The trick is to compare the ending '\0' as well, so that partial match
> > 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 = 0;
>
>   for (;;)
>   {
>     ret |= (*s1 != *s2);
>
>     if (*s1 == '\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



-- 
Regards
Vladimir 'phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]

  reply	other threads:[~2009-11-09 21:35 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-09  1:04 Imminent bugfix release (1.97.1) Robert Millan
2009-11-09  1:27 ` Robert Millan
2009-11-09  2:08 ` Jordan Uggla
2009-11-09 14:15   ` Robert Millan
2009-11-09 13:33 ` Bean
2009-11-09 13:50   ` Vladimir 'phcoder' Serbinenko
2009-11-09 14:18     ` Robert Millan
2009-11-09 14:21     ` Bean
2009-11-09 14:34       ` Vladimir 'phcoder' Serbinenko
2009-11-09 17:46         ` Duboucher Thomas
2009-11-09 18:10           ` Robert Millan
2009-11-09 18:15             ` Vladimir 'phcoder' Serbinenko
2009-11-09 18:25               ` Robert Millan
2009-11-09 18:36                 ` Bean
2009-11-09 18:46                   ` Vladimir 'phcoder' Serbinenko
2009-11-09 18:49                     ` Bean
2009-11-09 21:13                       ` Duboucher Thomas
2009-11-09 21:34                         ` Vladimir 'phcoder' Serbinenko [this message]
2009-11-09 21:43                           ` Duboucher Thomas
2009-11-09 22:06                             ` Robert Millan
2009-11-09 22:46                               ` Duboucher Thomas
2009-11-09 23:09                                 ` Darron Black
2009-11-09 23:50                                   ` richardvoigt
2009-11-09 23:56                                     ` Darron Black
2009-11-09 23:46                                 ` richardvoigt
2009-11-10  5:39                           ` Bean
2009-11-10  8:28                             ` Bean
2009-11-10  8:46                               ` Bean
2009-11-10  8:52                                 ` Bean
2009-11-10  9:05                                   ` Bean
2009-11-10 12:37                                     ` Bean
2009-11-10 14:25                                       ` Duboucher Thomas
2009-11-10 14:47                                         ` Bean
2009-11-10 17:43                                           ` Duboucher Thomas
2009-11-10 19:01                                             ` Vladimir 'phcoder' Serbinenko
2009-11-10 19:04                                           ` Vladimir 'phcoder' Serbinenko
2009-11-10 21:29                                             ` Duboucher Thomas
2009-11-10 15:27                                         ` richardvoigt
2009-11-10 17:38                                           ` Duboucher Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AF88AEF.8010102@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.