Skip to contentSkip to conversation

libsepol: potential NULL dereference from next_entry()

PATCH New [email protected] 1 participant 1 message Aug 18, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libsepol: potential NULL dereference from next_entry()

This patch fixes a bug found by Coverity:

If next_entry returns NULL in role_trans_rule_read(), we nevertheless reference buf[0].

policydb.c +2 -0
Index: src/policydb.c
===================================================================
@@ -2145,6 +2145,8 @@ static int role_trans_rule_read(role_tra
                         return -1;
 
                 buf = next_entry(fp, sizeof(uint32_t));
+		if (!buf)
+			return -1;
                 tr->new_role = le32_to_cpu(buf[0]);
                 ltr = tr;
         }

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.