[PATCH] hw/uefi: add missing uefi_str_is_valid check to uefi_vars_mm_lock_variable

Gerd Hoffmann posted 1 patch 1 week, 3 days ago
hw/uefi/var-service-vars.c | 4 ++++
1 file changed, 4 insertions(+)
[PATCH] hw/uefi: add missing uefi_str_is_valid check to uefi_vars_mm_lock_variable
Posted by Gerd Hoffmann 1 week, 3 days ago
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4213
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/uefi/var-service-vars.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/uefi/var-service-vars.c b/hw/uefi/var-service-vars.c
index e0ea3d532eb6..ef8849f81511 100644
--- a/hw/uefi/var-service-vars.c
+++ b/hw/uefi/var-service-vars.c
@@ -690,6 +690,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.55.0
Re: [PATCH] hw/uefi: add missing uefi_str_is_valid check to uefi_vars_mm_lock_variable
Posted by Luigi Leonardi 1 week, 2 days ago
On Wed, Sep 16, 2026 at 04:50:50PM +0200, Gerd Hoffmann wrote:
>Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4213
>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: Luigi Leonardi <leonardi@redhat.com>