From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>,
Peter Lustig <peter.lustig.7db@gmail.com>
Subject: Re: New command to check NT's hibernation state
Date: Mon, 28 Jan 2013 19:11:03 +0100 [thread overview]
Message-ID: <5106BF37.70906@gmail.com> (raw)
In-Reply-To: <4EF40444.5060303@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1461 bytes --]
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
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
next prev parent reply other threads:[~2013-01-28 18:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.235.1324573308.26580.grub-devel@gnu.org>
2011-12-23 4:32 ` New command to check NT's hibernation state Peter Lustig
2012-08-12 4:23 ` Peter Lustig
2013-01-28 18:11 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2013-11-04 1:55 Peter Lustig
[not found] <mailman.171.1324141254.27913.grub-devel@gnu.org>
2011-12-18 3:16 ` Peter Lustig
2011-12-22 12:10 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-04 0:48 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-04 13:13 ` Andrey Borzenkov
2013-11-04 13:24 ` Vladimir 'φ-coder/phcoder' Serbinenko
[not found] <mailman.213.1324054906.20674.grub-devel@gnu.org>
2011-12-17 5:41 ` Peter Lustig
2011-12-17 11:39 ` Vladimir 'φ-coder/phcoder' Serbinenko
[not found] <mailman.207.1322931671.23776.grub-devel@gnu.org>
2011-12-10 6:03 ` Peter Lustig
2011-12-16 15:25 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-12-16 15:30 ` Vladimir 'φ-coder/phcoder' Serbinenko
-- strict thread matches above, loose matches on Subject: below --
2011-12-03 4:57 Peter Lustig
2011-12-03 10:41 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-12-02 5:16 Peter Lustig
2011-12-02 6:05 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-11-27 23:49 Peter Lustig
2011-11-28 1:03 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-11-28 13:27 ` Vladimir 'φ-coder/phcoder' Serbinenko
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=5106BF37.70906@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.org \
--cc=peter.lustig.7db@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).