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

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