Skip to contentSkip to conversation

libsemanage: semanage_list_sort: handle a NULL *l correctly

PATCH In review Stephen Smalley 1 participant 2 messages Aug 26 – Aug 28 SELinux security module

lore
Share & tools
lore

Stephen Smalley

author maintainer
#0 lore raw

PATCH 1/1 libsemanage: semanage_list_sort: handle a NULL *l correctly

No existing caller passes semanage_list_sort() a NULL *l but we might as well check for future-proofing.

---
 libsemanage/src/utilities.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libsemanage/src/utilities.c +1 -1
index 678e1443..43851f8b 100644
@@ -167,7 +167,7 @@ int semanage_list_sort(semanage_list_t **l)
 	size_t count = 0;
 	size_t i = 0;
 
-	if (!l || !(*l)->next)
+	if (!l || !*l || !(*l)->next)
 		return 0;
 
 	for (temp = *l; temp; temp = temp->next)
Signature · 1 line
2.55.0