summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIlias Apalodimas <ilias.apalodimas@linaro.org>2020-12-31 12:26:46 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2020-12-31 14:33:23 +0100
commitfe179d7fb5c10d8a4e299af06c766f47f2c8d51a (patch)
tree5c762b7b7158c4692a774708b42af30726540a4d /test
parent47d2b3b9c98e1adf231f8143bc01b0046ebd5c9c (diff)
downloadu-boot-fe179d7fb5c10d8a4e299af06c766f47f2c8d51a.tar.gz
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>
Diffstat (limited to 'test')
-rw-r--r--test/unicode_ut.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index 33fc8b0ee1..6130ef0b54 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -603,7 +603,7 @@ static int unicode_test_efi_create_indexed_name(struct unit_test_state *uts)
u16 *pos;
memset(buf, 0xeb, sizeof(buf));
- pos = efi_create_indexed_name(buf, "Capsule", 0x0af9);
+ pos = efi_create_indexed_name(buf, sizeof(buf), "Capsule", 0x0af9);
ut_asserteq_mem(expected, buf, sizeof(expected));
ut_asserteq(pos - buf, u16_strnlen(buf, SIZE_MAX));