>From 5c71f20ebfa08b7f8d86eb57d5a73a8a44f5bb8e Mon Sep 17 00:00:00 2001 From: Nathan Kinder <nkinder@xxxxxxxxxx> Date: Mon, 16 Nov 2009 15:49:57 -0800 Subject: [PATCH] Avoid freeing NULL trimmed passwords list My previous patch for removing the fixed length buffer used in the password history checking code introduced a problem where we could attempt to free a NULL pointer. --- ldap/servers/slapd/pw.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c index 76dce38..cafdfd6 100644 --- a/ldap/servers/slapd/pw.c +++ b/ldap/servers/slapd/pw.c @@ -1120,7 +1120,7 @@ int update_pw_history( Slapi_PBlock *pb, char *dn, char *old_pw ) { static int pw_in_history( Slapi_Value **history_vals, const Slapi_Value *pw_val) { - Slapi_Value **trimmed_history; + Slapi_Value **trimmed_history = NULL; int num_history_vals = 0; int i; int ret = -1; @@ -1183,16 +1183,16 @@ int pw_in_history( Slapi_Value **history_vals, const Slapi_Value *pw_val) /* Check if the new password is in the trimmed history list. */ ret = slapi_pw_find_sv(trimmed_history, pw_val); - } - /* Free the trimmed values. */ - for ( i = 0; trimmed_history[i] != NULL; i++ ) - { - slapi_ch_free((void **)&trimmed_history[i]); - } + /* Free the trimmed values. */ + for ( i = 0; trimmed_history[i] != NULL; i++ ) + { + slapi_ch_free((void **)&trimmed_history[i]); + } - /* Free the array. */ - slapi_ch_free((void **)&trimmed_history); + /* Free the array. */ + slapi_ch_free((void **)&trimmed_history); + } return ( ret ); } -- 1.6.2.5
-- 389-devel mailing list 389-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-directory-devel