From: Gerd Hoffmann <[email protected]>

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4213
Reviewed-by: Luigi Leonardi <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
Message-ID: <[email protected]>
(cherry picked from commit ff96d562906644699c6a553c35e6cd51383c26c2)
Signed-off-by: Michael Tokarev <[email protected]>

diff --git a/hw/uefi/var-service-vars.c b/hw/uefi/var-service-vars.c
index 49ecbaec1f8..67869b79f51 100644
--- a/hw/uefi/var-service-vars.c
+++ b/hw/uefi/var-service-vars.c
@@ -652,6 +652,10 @@ uefi_vars_mm_lock_variable(uefi_vars_state *uv, mm_header 
*mhdr,
         return uefi_vars_mm_error(mhdr, mvar, EFI_BAD_BUFFER_SIZE);
     }
 
+    if (!uefi_str_is_valid(name, lv->name_size, true)) {
+        return uefi_vars_mm_error(mhdr, mvar, EFI_INVALID_PARAMETER);
+    }
+
     uefi_trace_variable(__func__, lv->guid, name, lv->name_size);
 
     pe = g_malloc0(sizeof(*pe) + lv->name_size);
-- 
2.47.3


Reply via email to