]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: parameter checks SetVariable()
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Wed, 12 Jun 2019 21:28:42 +0000 (23:28 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 14 Jun 2019 17:18:40 +0000 (19:18 +0200)
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>
lib/efi_loader/efi_variable.c

index e56053194daec46642103607904e85ed4f37aa3c..1d1b23b0e550ec2961e6ce31b1e6d446ecbff2d5 100644 (file)
@@ -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;