dcavalca / rpms / systemd

Forked from rpms/systemd 4 months ago
Clone
9fc0f6
From 650948f16d92ce6b55e01ff2c24ea00766d38474 Mon Sep 17 00:00:00 2001
9fc0f6
From: Lennart Poettering <lennart@poettering.net>
9fc0f6
Date: Wed, 2 Oct 2013 19:38:09 +0200
9fc0f6
Subject: [PATCH] efi: never call qsort on potentially NULL arrays
9fc0f6
9fc0f6
---
9fc0f6
 src/shared/efivars.c | 3 ++-
9fc0f6
 1 file changed, 2 insertions(+), 1 deletion(-)
9fc0f6
9fc0f6
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
9fc0f6
index 1d5b6f9..c015b16 100644
9fc0f6
--- a/src/shared/efivars.c
9fc0f6
+++ b/src/shared/efivars.c
9fc0f6
@@ -384,7 +384,8 @@ int efi_get_boot_options(uint16_t **options) {
9fc0f6
                 list[count ++] = id;
9fc0f6
         }
9fc0f6
 
9fc0f6
-        qsort(list, count, sizeof(uint16_t), cmp_uint16);
9fc0f6
+        if (list)
9fc0f6
+                qsort(list, count, sizeof(uint16_t), cmp_uint16);
9fc0f6
 
9fc0f6
         *options = list;
9fc0f6
         return count;