summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2019-06-12 23:28:42 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2019-06-14 19:18:40 +0200
commitc77d8e9d893ea06082e3ea0f609895b306db1623 (patch)
treefb2b457d1834e0ee40d0b2bb5e595061a73cc03a /lib
parent17416eaff2bee8f81a094fb2805a2f1920c81a5e (diff)
downloadu-boot-c77d8e9d893ea06082e3ea0f609895b306db1623.tar.gz
u-boot-c77d8e9d893ea06082e3ea0f609895b306db1623.tar.bz2
u-boot-c77d8e9d893ea06082e3ea0f609895b306db1623.zip
efi_loader: parameter checks SetVariable()
Return EFI_INVALID_PARAMETER if the variable name has zero length or the variable has runtime access but not boottime access. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_variable.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index e56053194d..1d1b23b0e5 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -430,7 +430,9 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
data_size, data);
/* TODO: implement APPEND_WRITE */
- if (!variable_name || !vendor ||
+ if (!variable_name || !*variable_name || !vendor ||
+ ((attributes & EFI_VARIABLE_RUNTIME_ACCESS) &&
+ !(attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS)) ||
(attributes & EFI_VARIABLE_APPEND_WRITE)) {
ret = EFI_INVALID_PARAMETER;
goto out;