[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] check ebitmap_write return value in policydb_write
The following patch fixes a bug found by Coverity in libsepol:
In policydb_write, the return value of ebitmap_write() is not
checked.
Index: src/write.c
===================================================================
--- src.orig/write.c
+++ src/write.c
@@ -1514,8 +1514,10 @@ int policydb_write(policydb_t * p, struc
}
if (policy_type == POLICY_KERN && policyvers >= POLICYDB_VERSION_AVTAB) {
- for (i = 0; i < p->p_types.nprim; i++)
- ebitmap_write(&p->type_attr_map[i], fp);
+ for (i = 0; i < p->p_types.nprim; i++) {
+ if (ebitmap_write(&p->type_attr_map[i], fp) == -1)
+ return -1;
+ }
}
return 0;
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.
This mailing list archive is a service of Copilot Consulting.