efi_loader: Add size checks to efi_create_indexed_name()
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Thu, 31 Dec 2020 10:26:46 +0000 (12:26 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 31 Dec 2020 13:33:23 +0000 (14:33 +0100)
commitfe179d7fb5c10d8a4e299af06c766f47f2c8d51a
tree5c762b7b7158c4692a774708b42af30726540a4d
parent47d2b3b9c98e1adf231f8143bc01b0046ebd5c9c
efi_loader: Add size checks to efi_create_indexed_name()

Although the function description states the caller must provide a
sufficient buffer, it's better to have in function checks that the
destination buffer can hold the intended value.

So let's add an extra argument with the buffer size and check that
before doing any copying.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
include/efi_loader.h
lib/efi_loader/efi_capsule.c
lib/efi_loader/efi_string.c
test/unicode_ut.c