Skip to contentSkip to conversation

hw/uefi: add missing uefi_str_is_valid check to uefi_vars_mm_lock_variable

PATCH In review Gerd Hoffmann 2 participants 2 messages Sep 16 – Sep 17

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/uefi: add missing uefi_str_is_valid check to uefi_vars_mm_lock_variable

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4213

---
 hw/uefi/var-service-vars.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/uefi/var-service-vars.c +4 -0
index e0ea3d532eb6..ef8849f81511 100644
@@ -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);
Signature · 1 line
2.55.0