summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-01-11 16:32:52 +0100
committerRob Crittenden <rcritten@redhat.com>2011-01-12 11:44:08 -0500
commitd03ffeabe20c8f336d536232d9d6d2ce2087b152 (patch)
tree732598ac1e7aa623748b88fe297eafb0cb9d94ca
parent5a0c9371cba9725a5daca26a0a4c5053c5964921 (diff)
downloadfreeipa-d03ffeabe20c8f336d536232d9d6d2ce2087b152.tar.gz
freeipa-d03ffeabe20c8f336d536232d9d6d2ce2087b152.tar.xz
freeipa-d03ffeabe20c8f336d536232d9d6d2ce2087b152.zip
Unchecked return value of calloc
Omiting return value of calloc in ipa_pwd_extop.c could lead to memory access issues when memory is full. This patch adds return value check. https://fedorahosted.org/freeipa/ticket/717
-rw-r--r--daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c
index 117ccf08..5867f084 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c
@@ -853,6 +853,13 @@ static int ipapwd_setkeytab(Slapi_PBlock *pb, struct ipapwd_krbcfg *krbcfg)
char * enrolledBy = slapi_entry_attr_get_charptr(targetEntry, "enrolledBy");
if (NULL == enrolledBy) {
evals = (Slapi_Value **)calloc(2, sizeof(Slapi_Value *));
+
+ if (!evals) {
+ LOG_OOM();
+ slapi_mods_free(&smods);
+ goto free_and_return;
+ }
+
evals[0] = slapi_value_new_string(bindDN);
slapi_mods_add_mod_values(smods, LDAP_MOD_ADD, "enrolledBy", evals);
} else {