From: Heinrich Schuchardt Date: Mon, 13 Feb 2023 18:22:33 +0000 (+0100) Subject: efi_loader: avoid buffer overrun in efi_var_mem_compare X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=67af329a741b546986be2f3b18933f8c8b373bed;p=u-boot.git efi_loader: avoid buffer overrun in efi_var_mem_compare We should not scan beyond the end of string name. Signed-off-by: Heinrich Schuchardt --- diff --git a/lib/efi_loader/efi_var_mem.c b/lib/efi_loader/efi_var_mem.c index e1058e3c6a..d6b65aed12 100644 --- a/lib/efi_loader/efi_var_mem.c +++ b/lib/efi_loader/efi_var_mem.c @@ -41,11 +41,13 @@ efi_var_mem_compare(struct efi_var_entry *var, const efi_guid_t *guid, i < sizeof(efi_guid_t) && match; ++i) match = (guid1[i] == guid2[i]); - for (data = var->name, var_name = name;; ++data, ++var_name) { + for (data = var->name, var_name = name;; ++data) { if (match) match = (*data == *var_name); if (!*data) break; + if (*var_name) + ++var_name; } ++data;