Omitting 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

>From 6444892240f796d5fc2bd6707a64fc731bc0c6eb Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Tue, 11 Jan 2011 16:32:52 +0100
Subject: [PATCH] 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
---
 .../ipa-pwd-extop/ipa_pwd_extop.c                  |    7 +++++++
 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 117ccf0835695d1179c29f2fbe230a60f36b7d70..5867f0846207351b689724361c11bf56e53cb15b 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 {
-- 
1.7.3.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to