diff mbox series

Avoid segfault on x86-64 with invalid EFI boot entries

Message ID 20260901071121.834356-1-rhidian.dewit@openpixelsystems.org
State New
Headers show
Series Avoid segfault on x86-64 with invalid EFI boot entries | expand

Commit Message

Rhidian De Wit Sept. 1, 2026, 7:11 a.m. UTC
Signed-off-by: Rhidian De Wit <rhidian.dewit@openpixelsystems.org>
---
 ...bootcurrent-is-valid-before-using-it.patch | 41 +++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 package/rauc/0001-Check-if-bootcurrent-is-valid-before-using-it.patch

Comments

Rhidian De Wit Sept. 1, 2026, 7:12 a.m. UTC | #1
Apologies for the confusion on my end, these are the correct patches.
diff mbox series

Patch

diff --git a/package/rauc/0001-Check-if-bootcurrent-is-valid-before-using-it.patch b/package/rauc/0001-Check-if-bootcurrent-is-valid-before-using-it.patch
new file mode 100644
index 0000000000..a70ab29fa0
--- /dev/null
+++ b/package/rauc/0001-Check-if-bootcurrent-is-valid-before-using-it.patch
@@ -0,0 +1,41 @@ 
+From 48a0c8b2e647fe34cc53a4b55a43d4106fe45735 Mon Sep 17 00:00:00 2001
+From: Rhidian De Wit <rhidian.dewit@openpixelsystems.org>
+Date: Mon, 24 Aug 2026 10:04:24 +0200
+Subject: [PATCH] Check if bootcurrent is valid before using it
+
+Upstream: https://github.com/rauc/rauc/pull/2029
+
+Signed-off-by: Rhidian De Wit <rhidian.dewit@openpixelsystems.org>
+---
+ src/bootloaders/efi.c | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/src/bootloaders/efi.c b/src/bootloaders/efi.c
+index 19224118..65875c9f 100644
+--- a/src/bootloaders/efi.c
++++ b/src/bootloaders/efi.c
+@@ -625,12 +625,15 @@ gchar *r_efi_get_current_bootname(RaucConfig *config, GError **error)
+ 		return NULL;
+ 	}
+ 
+-	GHashTableIter iter;
+-	g_hash_table_iter_init(&iter, config->slots);
+-	RaucSlot *slot = NULL;
+-	while (g_hash_table_iter_next(&iter, NULL, (gpointer*) &slot)) {
+-		if (g_strcmp0(slot->bootname, bootcurrent->name) == 0) {
+-			return slot->bootname;
++	if (bootcurrent != NULL)
++	{
++		GHashTableIter iter;
++		g_hash_table_iter_init(&iter, config->slots);
++		RaucSlot *slot = NULL;
++		while (g_hash_table_iter_next(&iter, NULL, (gpointer*) &slot)) {
++			if (g_strcmp0(slot->bootname, bootcurrent->name) == 0) {
++				return slot->bootname;
++			}
+ 		}
+ 	}
+ 
+-- 
+2.51.0
+