+2011-06-27 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/lib/relocator.c (malloc_in_range): Fix a memory corruption
+ when handling leftovers.
+
2011-06-27 Vladimir Serbinenko <phcoder@gmail.com>
* util/ieee1275/grub-ofpathname.c (main): Handle --help and --version
int inreg = 0, regbeg = 0, ncol = 0;
#if GRUB_RELOCATOR_HAVE_FIRMWARE_REQUESTS
int fwin = 0, fwb = 0, fwlefto = 0;
+#endif
+#if GRUB_RELOCATOR_HAVE_LEFTOVERS
+ int last_lo = 0;
#endif
int last_start = 0;
for (j = 0; j < N; j++)
unsigned offend = alloc_end
% GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT;
struct grub_relocator_fw_leftover *lo
- = events[last_start].leftover;
+ = events[last_lo].leftover;
lo->freebytes[offstart / 8]
&= ((1 << (8 - (start % 8))) - 1);
grub_memset (lo->freebytes + (offstart + 7) / 8, 0,
#if GRUB_RELOCATOR_HAVE_LEFTOVERS
case REG_LEFTOVER_START:
fwlefto++;
+ last_lo = j;
break;
case REG_LEFTOVER_END:
curschu->extra = ne;
}
}
-#if GRUB_RELOCATOR_HAVE_FIRMWARE_REQUESTS
+
+#if GRUB_RELOCATOR_HAVE_LEFTOVERS
if (!oom && typepre == CHUNK_TYPE_FIRMWARE)
{
grub_addr_t fstart, fend;
= ALIGN_UP (alloc_end,
GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT);
-#if GRUB_RELOCATOR_HAVE_LEFTOVERS
{
struct grub_relocator_fw_leftover *lo1 = NULL;
struct grub_relocator_fw_leftover *lo2 = NULL;
curschu->pre = lo1;
curschu->post = lo2;
}
-#endif
}
-#if GRUB_RELOCATOR_HAVE_LEFTOVERS
if (typepre == CHUNK_TYPE_LEFTOVER)
{
curschu->pre = events[last_start].leftover;
}
#endif
-#endif
if (!oom)
cural++;
else