+2013-02-25 Andrey Borzenkov <arvidjaar@gmail.com>
+
+ * grub-core/normal/menu_entry.c (insert_string): fix off by one
+ access to unallocated memory.
+
2013-02-25 Andrey Borzenkov <arvidjaar@gmail.com>
* Makefile.util.def: Add partmap/msdos.c to common library.
if (! screen->lines)
return 0;
- /* Scroll down. */
- grub_memmove (screen->lines + screen->line + 2,
- screen->lines + screen->line + 1,
- ((screen->num_lines - screen->line - 2)
- * sizeof (struct line)));
+ /* Shift down if not appending after the last line. */
+ if (screen->line < screen->num_lines - 2)
+ grub_memmove (screen->lines + screen->line + 2,
+ screen->lines + screen->line + 1,
+ ((screen->num_lines - screen->line - 2)
+ * sizeof (struct line)));
if (! init_line (screen, screen->lines + screen->line + 1))
return 0;