On 12/22/2011 11:32 PM, 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.
Sorry to bump this thread. Do you know if there are any plans to
include the 'nthibr' module in a future release of GRUB. I looked and
didn't see any references to it in the Bazaar trunk.
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel