On Fri, Sep 01, 2023 at 09:16:24PM -0500, Glenn Washburn wrote: > When failing to allocate the preallocate buffer, grub_xvasprintf() > returns NULL, but does not set grub_errno. Returning NULL is sufficient > for a caller to determine there was an error. However, some usages of > grub_xvasprintf() check for a NULL return value and then return > grub_errno, which could return some previously set error code or > potentially even a success code. > > Signed-off-by: Glenn Washburn <developm...@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.ki...@oracle.com> > --- > grub-core/kern/misc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c > index b57249acb81b..afb41bd63a6a 100644 > --- a/grub-core/kern/misc.c > +++ b/grub-core/kern/misc.c > @@ -1232,6 +1232,7 @@ grub_xvasprintf (const char *fmt, va_list ap) > if (!ret) > { > free_printf_args (&args); > + grub_error (GRUB_ERR_OUT_OF_MEMORY, "grub_xvasprintf failed to > allocate memory of size %" PRIuGRUB_SIZE, as); Nit, s/grub_xvasprintf/grub_xvasprintf()/... Daniel _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel