On Wed, Dec 30, 2020 at 07:34:38PM +0100, Heinrich Schuchardt wrote: > On 12/30/20 4:07 PM, Ilias Apalodimas wrote: > > Although the function description states the caller must provide a > > sufficient buffer, it's better to have in function checks and ensure > > the destination buffer can hold the intended variable name. > > > > So let's add an extra argument with the buffer size and check that > > before copying. > > > > Signed-off-by: Ilias Apalodimas <[email protected]> > > --- > > include/efi_loader.h | 3 ++- > > lib/efi_loader/efi_string.c | 10 ++++++++-- > > test/unicode_ut.c | 2 +- > > 3 files changed, 11 insertions(+), 4 deletions(-) > > > > diff --git a/include/efi_loader.h b/include/efi_loader.h > > index 3c68b85b68e9..af30dbafab77 100644 > > --- a/include/efi_loader.h > > +++ b/include/efi_loader.h > > @@ -810,7 +810,8 @@ bool efi_image_parse(void *efi, size_t len, struct > > efi_image_regions **regp, > > void efi_memcpy_runtime(void *dest, const void *src, size_t n); > > > > /* commonly used helper function */ > > -u16 *efi_create_indexed_name(u16 *buffer, const char *name, unsigned int > > index); > > +u16 *efi_create_indexed_name(u16 *buffer, size_t buffer_size, const char > > *name, > > + unsigned int index); > > > > #else /* CONFIG_IS_ENABLED(EFI_LOADER) */ > > Please, rebase upon origin/next. > > With this patch U-Boot does not compile: > > lib/efi_loader/efi_capsule.c: In function ‘set_capsule_result’: > lib/efi_loader/efi_capsule.c:76:43: error: passing argument 2 of > ‘efi_create_indexed_name’ makes integer from pointer without a cast > [-Werror=int-conversion] > 76 | efi_create_indexed_name(variable_name16, "Capsule", index); > | ^~~~~~~~~ > | | > | char * > > You missed to update lib/efi_loader/efi_capsule.c as you series is based > on origin/master.
Bah sorry! I'll rebase this on top of master and send it as a seperate patchset. Cheers /Ilias

