arrfab / rpms / shim-signed

Forked from rpms/shim-signed 4 years ago
Clone

Blame SOURCES/0001-Fix-the-potential-buffer-overflow.patch

112f40
From 1313fa02a5b2bfe61ee6702696600fc148ec2d6e Mon Sep 17 00:00:00 2001
112f40
From: Gary Ching-Pang Lin <glin@suse.com>
112f40
Date: Tue, 4 Nov 2014 15:50:03 +0800
112f40
Subject: [PATCH 01/10] Fix the potential buffer overflow
112f40
112f40
Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
112f40
---
112f40
 src/mokutil.c | 5 ++---
112f40
 1 file changed, 2 insertions(+), 3 deletions(-)
112f40
112f40
diff --git a/src/mokutil.c b/src/mokutil.c
112f40
index 5b34f22fd98..93fb6fabcab 100644
112f40
--- a/src/mokutil.c
112f40
+++ b/src/mokutil.c
112f40
@@ -1743,7 +1743,7 @@ set_toggle (const char * VarName, uint32_t state)
112f40
 	MokToggleVar tvar;
112f40
 	char *password = NULL;
112f40
 	unsigned int pw_len;
112f40
-	efi_char16_t efichar_pass[SB_PASSWORD_MAX];
112f40
+	efi_char16_t efichar_pass[SB_PASSWORD_MAX+1];
112f40
 	int ret = -1;
112f40
 
112f40
 	printf ("password length: %d~%d\n", SB_PASSWORD_MIN, SB_PASSWORD_MAX);
112f40
@@ -1757,8 +1757,7 @@ set_toggle (const char * VarName, uint32_t state)
112f40
 	efichar_from_char (efichar_pass, password,
112f40
 			   SB_PASSWORD_MAX * sizeof(efi_char16_t));
112f40
 
112f40
-	memcpy(tvar.password, efichar_pass,
112f40
-	       SB_PASSWORD_MAX * sizeof(efi_char16_t));
112f40
+	memcpy(tvar.password, efichar_pass, sizeof(tvar.password));
112f40
 
112f40
 	tvar.mok_toggle_state = state;
112f40
 
112f40
-- 
112f40
2.17.1
112f40