[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Imminent bugfix release (1.97.1)
From: |
Vladimir 'phcoder' Serbinenko |
Subject: |
Re: Imminent bugfix release (1.97.1) |
Date: |
Mon, 09 Nov 2009 22:34:39 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.22 (X11/20090701) |
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
address@hidden
http://lists.gnu.org/mailman/listinfo/grub-devel
--
Regards
Vladimir 'phcoder' Serbinenko
signature.asc
Description: OpenPGP digital signature
- Re: Imminent bugfix release (1.97.1), (continued)
- Re: Imminent bugfix release (1.97.1), Bean, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Vladimir 'phcoder' Serbinenko, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Duboucher Thomas, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Robert Millan, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Vladimir 'phcoder' Serbinenko, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Robert Millan, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Bean, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Vladimir 'phcoder' Serbinenko, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Bean, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Duboucher Thomas, 2009/11/09
- Re: Imminent bugfix release (1.97.1),
Vladimir 'phcoder' Serbinenko <=
- Re: Imminent bugfix release (1.97.1), Duboucher Thomas, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Robert Millan, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Duboucher Thomas, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Darron Black, 2009/11/09
- Re: Imminent bugfix release (1.97.1), address@hidden, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Darron Black, 2009/11/09
- Re: Imminent bugfix release (1.97.1), address@hidden, 2009/11/09
- Re: Imminent bugfix release (1.97.1), Bean, 2009/11/10
- Re: Imminent bugfix release (1.97.1), Bean, 2009/11/10
- Re: Imminent bugfix release (1.97.1), Bean, 2009/11/10