script/execute: Add NULL check for grub_calloc in gettext_append
PATCH 1/1 script/execute: Add NULL check for grub_calloc in gettext_append
Add a NULL check after grub_calloc in gettext_append to handle allocation errors. This prevents using a NULL pointer and stops crashes during string translation.
Signed-off-by Sridhar Markonda <[email protected]>
Signed-off-by Sudhakar Kuppusamy <[email protected]>
--- grub-core/script/execute.c | 2 ++ 1 file changed, 2 insertions(+)
grub-core/script/execute.c +2 -0
@@ -562,6 +562,8 @@ gettext_append (struct grub_script_argv *result, const char *orig_str)if (*iptr =='$' ) dollar_cnt++; ctx.allowed_strings =grub_calloc (dollar_cnt,sizeof (ctx.allowed_strings[0 ])); +if (ctx.allowed_strings ==NULL ) + goto fail;if (parse_string (orig_str, gettext_save_allow, &ctx,0 )) goto fail;
Signature · 7 lines
2.47.3 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 5 lines · Sridhar Markonda
Add a NULL check after
grub_callocingettext_appendto handle allocation errors. This prevents using a NULL pointer and stops crashes during string translation.Signed-off-by Sridhar Markonda <[email protected]>Signed-off-by Sudhakar Kuppusamy <[email protected]>
Reviewed-by Daniel Kiper <[email protected]>
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel