grub2/0385-include-grub-list.h-FOR_LIST_ELEMENTS_SAFE-Fix-a-NUL.patch
2013-06-07 14:03:56 -04:00

44 lines
1.6 KiB
Diff

From 36c2c2e18dd471bdfd886021afb0d5e8365b2c8e Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 29 Apr 2013 12:00:31 +0200
Subject: [PATCH 385/471] * include/grub/list.h
(FOR_LIST_ELEMENTS_SAFE):Fix a NULL pointer dereference. Reported by:
qwertial.
---
ChangeLog | 6 ++++++
include/grub/list.h | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index f444ea9..bf413de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2013-04-29 Vladimir Serbinenko <phcoder@gmail.com>
+ * include/grub/list.h (FOR_LIST_ELEMENTS_SAFE):Fix a NULL pointer
+ dereference.
+ Reported by: qwertial.
+
+2013-04-29 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/kern/mips/arc/init.c: Fix prefix detection.
2013-04-29 Vladimir Serbinenko <phcoder@gmail.com>
diff --git a/include/grub/list.h b/include/grub/list.h
index 6f6dec0..edd20ad 100644
--- a/include/grub/list.h
+++ b/include/grub/list.h
@@ -35,7 +35,7 @@ void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
void EXPORT_FUNC(grub_list_remove) (grub_list_t item);
#define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next)
-#define FOR_LIST_ELEMENTS_SAFE(var, nxt, list) for ((var) = (list), (nxt) = ((var) ? (var)->next : 0); (var); (var) = (nxt), (nxt) = (var)->next)
+#define FOR_LIST_ELEMENTS_SAFE(var, nxt, list) for ((var) = (list), (nxt) = ((var) ? (var)->next : 0); (var); (var) = (nxt), ((nxt) = (var) ? (var)->next : 0))
static inline void *
grub_bad_type_cast_real (int line, const char *file)
--
1.8.2.1