Browse Source

Bug(s) fixed: 204623
Bug Description: deleting attributes when changing password causes server crash
Reviewed by: nhosoi (Thanks!)
Fix Description: From Michal: "The function mod2smod does not check for mod->mod_bvalues being NULL and tries
to dereference it (modutil.c:370). This function happens to be called only by
slapi_mods_get_{first,next}_smod(), which are in turn called only by
check_trivial_words() in pw.c; this is why the crash appears only when checking
password syntax."
I added the same check for the mod_values case - even though the
code says this should never be called, better to be safe than sorry.
Platforms tested: RHEL4

Rich Megginson 19 years ago
parent
commit
e5bace3a74
1 changed files with 2 additions and 2 deletions
  1. 2 2
      ldap/servers/slapd/modutil.c

+ 2 - 2
ldap/servers/slapd/modutil.c

@@ -367,7 +367,7 @@ mod2smod (LDAPMod *mod, Slapi_Mod *smod)
 
 	if (mod->mod_op & LDAP_MOD_BVALUES)
 	{
-		while (mod->mod_bvalues[smod->num_values])
+		while (mod->mod_bvalues && mod->mod_bvalues[smod->num_values])
 		{
 			smod->num_values ++;
 		}
@@ -375,7 +375,7 @@ mod2smod (LDAPMod *mod, Slapi_Mod *smod)
 	else
 	{
 		PR_ASSERT(0); /* ggood shouldn't ever use string values in server */
-		while (mod->mod_values[smod->num_values])
+		while (mod->mod_values && mod->mod_values[smod->num_values])
 		{
 			smod->num_values ++;
 		}