richardphibel / rpms / systemd

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