[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New command to check NT's hibernation state
From: |
Vladimir 'φ-coder/phcoder' Serbinenko |
Subject: |
Re: New command to check NT's hibernation state |
Date: |
Mon, 28 Jan 2013 19:11:03 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11 |
On 23.12.2011 05:32, Peter Lustig wrote:
> On 12/22/2011 13:10, Vladimir 'phcoder' Serbinenko wrote:
>> On 18.12.2011 04:16, Peter Lustig wrote:
>>> > /* Return SUCCESS if magic indicates file is active; else
>>> return FAILURE */
>>> > if (!grub_strncasecmp ("hibr", hibr_file_magic, magic_size))
>> What's the reason to use strncasecmp? Does the case changes? Usually
>> memcmp is the right way to check the signature. This also avoids the
>> need of memset and trailing zero byte.
> It can be either {'h', 'i', 'b', 'r'} (for Windows XP) or {'H', 'I',
> 'B', 'R'} (for Windows Vista/7). Technically I should only be checking
> for these two values, but it is unlikely that the magic would have mixed
> case. The only other values I know (from
> <http://www.msuiche.net/pres/PacSec07-slides-0.4.pdf>) that it can
> assume are {'w', 'a', 'k', 'e'}, {'l', 'i', 'n', 'k'}, and {'\0', '\0',
> '\0', '\0'}. Using strncasecmp() seemed like a simple way to approach
> the problem.
>
strncasecmp isn't for comparing te binary strings. In GRUB it's fairly
simplistic but this is conceptually wrong. Conceptually híbr and HIBR
would match even if GRUB currently doesn't do this kind of handling.
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
signature.asc
Description: OpenPGP digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: New command to check NT's hibernation state,
Vladimir 'φ-coder/phcoder' Serbinenko <=