Add a NULL check to prevent failure from grub_calloc in update_screen. This stops possible NULL pointer dereference and avoids unexpected behavior.
Signed-off-by: Sridhar Markonda <[email protected]> --- grub-core/normal/menu_entry.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c index 8b0d17e3f..dfba20cb9 100644 --- a/grub-core/normal/menu_entry.c +++ b/grub-core/normal/menu_entry.c @@ -296,7 +296,11 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen, pos = linep->pos + (term_screen - screen->terms); if (!*pos) - *pos = grub_calloc (linep->len + 1, sizeof (**pos)); + { + *pos = grub_calloc (linep->len + 1, sizeof (**pos)); + if (!*pos) + return; + } if (i == region_start || linep == screen->lines + screen->line || (i > region_start && mode == ALL_LINES)) -- 2.47.3 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
