Skip to content
Snippets Groups Projects
Verified Commit 1efb0d06 authored by Sherif Nagy's avatar Sherif Nagy
Browse files

Remove duplicate patch 365.patch

parent 1b3d15bf
No related branches found
No related tags found
No related merge requests found
From 764021ad8e01f5f5122612059ba5d8ab10ff6a3b Mon Sep 17 00:00:00 2001
From: Jonathan Yong <jonathan.yong@intel.com>
Date: Fri, 16 Apr 2021 09:59:03 +0800
Subject: [PATCH] mok: fix potential buffer overrun in import_mok_state
Fix the case where data_size is 0, so config_template is
not implicitly copied like the size calculation above.
upstream-status: https://github.com/rhboot/shim/issues/249
Signed-off-by: Jonathan Yong <jonathan.yong@intel.com>
---
mok.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/mok.c b/mok.c
index beac0ff6..db18093d 100644
--- a/mok.c
+++ b/mok.c
@@ -1034,10 +1034,12 @@ EFI_STATUS import_mok_state(EFI_HANDLE image_handle)
config_template.data_size = v->data_size;
- CopyMem(p, &config_template, sizeof(config_template));
- p += sizeof(config_template);
- CopyMem(p, v->data, v->data_size);
- p += v->data_size;
+ if (v->data && v->data_size) {
+ CopyMem(p, &config_template, sizeof(config_template));
+ p += sizeof(config_template);
+ CopyMem(p, v->data, v->data_size);
+ p += v->data_size;
+ }
}
if (p) {
ZeroMem(&config_template, sizeof(config_template));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment