summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2019-01-22 20:10:46 +0100
committerAlexander Graf <agraf@suse.de>2019-02-13 09:40:06 +0100
commiteefb790e9010282fb5c430cb18986f3838181c6d (patch)
tree91bbad4aef4f9e63c16dbbebf4dd33cbccbdaff5 /lib
parent6c75db07f4115904a460540c8956db2087cceb1f (diff)
downloadu-boot-eefb790e9010282fb5c430cb18986f3838181c6d.tar.gz
efi_loader: fix GetNextVariableName
Our current implementation of GetNextVariableName() first collects all EFI variables. If none is found at all hexport_r() returns a zero length string terminated by \0 and the value 1 as number of bytes in the returned buffer. In this case GetNextVariableName() has to return EFI_NOT_FOUND. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_variable.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index d94a5f6974..e0d7f5736d 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -383,7 +383,8 @@ efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size,
list_len = hexport_r(&env_htab, '\n',
H_MATCH_REGEX | H_MATCH_KEY,
&efi_variables_list, 0, 1, regexlist);
- if (list_len <= 0)
+ /* 1 indicates that no match was found */
+ if (list_len <= 1)
return EFI_EXIT(EFI_NOT_FOUND);
variable = efi_variables_list;