From a132afc371ad02665dfcb10224f183e03b04d0b8 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 29 Feb 2012 19:02:18 +0100 Subject: [PATCH] * include/grub/kernel.h (FOR_MODULES): Check module magic. --- ChangeLog | 4 ++++ include/grub/kernel.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dc34c7077..ba2538e51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-02-29 Vladimir Serbinenko + + * include/grub/kernel.h (FOR_MODULES): Check module magic. + 2012-02-29 Vladimir Serbinenko * util/grub-mkimagexx.c (locate_sections): Support non-standard diff --git a/include/grub/kernel.h b/include/grub/kernel.h index 4c8b29c8b..eef4c3ffb 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h @@ -72,7 +72,7 @@ struct grub_module_info64 extern grub_addr_t EXPORT_VAR (grub_modbase); #define FOR_MODULES(var) for (\ - var = grub_modbase ? (struct grub_module_header *) \ + var = (grub_modbase && ((((struct grub_module_info *) grub_modbase)->magic) == GRUB_MODULE_MAGIC)) ? (struct grub_module_header *) \ (grub_modbase + (((struct grub_module_info *) grub_modbase)->offset)) : 0;\ var && (grub_addr_t) var \ < (grub_modbase + (((struct grub_module_info *) grub_modbase)->size)); \