arrfab / rpms / shim

Forked from rpms/shim 4 years ago
Clone

Blame SOURCES/0046-unhook_system_services-bail-on-systab-NULL.patch

4210fa
From 77cdb40423e29a5f9d1318cd0ada874ee1916450 Mon Sep 17 00:00:00 2001
4210fa
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4210fa
Date: Tue, 12 Aug 2014 15:33:19 +0200
4210fa
Subject: [PATCH 46/74] unhook_system_services: bail on systab == NULL
4210fa
4210fa
Prevent unhook_system_services() from dereferencing a NULL systab, which
4210fa
may occur if hook_system_services() has never been called.
4210fa
4210fa
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4210fa
---
4210fa
 replacements.c | 3 +++
4210fa
 1 file changed, 3 insertions(+)
4210fa
4210fa
diff --git a/replacements.c b/replacements.c
4210fa
index 48dc437..5dfa355 100644
4210fa
--- a/replacements.c
4210fa
+++ b/replacements.c
4210fa
@@ -70,6 +70,9 @@ static EFI_HANDLE last_loaded_image;
4210fa
 void
4210fa
 unhook_system_services(void)
4210fa
 {
4210fa
+	if (!systab)
4210fa
+		return;
4210fa
+
4210fa
 	systab->BootServices->Exit = system_exit;
4210fa
 	systab->BootServices->LoadImage = system_load_image;
4210fa
 	systab->BootServices->StartImage = system_start_image;
4210fa
-- 
4210fa
1.9.3
4210fa