https://bugs.openldap.org/show_bug.cgi?id=9420
Issue ID: 9420 Summary: memory leak & ub in servers/slapd/modrdn.c`slap_modrdn2mods() Product: OpenLDAP Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: --- Component: slapd Assignee: bugs@openldap.org Reporter: grapvar@gmail.com Target Milestone: ---
Created attachment 781 --> https://bugs.openldap.org/attachment.cgi?id=781&action=edit fix
Hi. I have noticed
1) a memory leak in failure cleanup section of slap_modrdn2mods():
| for ( ; op->orr_modlist != NULL; op->orr_modlist = tmp ) { | tmp = op->orr_modlist->sml_next; | ch_free( op->orr_modlist ); | }
this code leaks (n)values of mods. And
2) undefined behavior while scheduling delete:
| (void) (*desc->ad_type->sat_equality->smr_normalize)(..., &mod_tmp->sml_nvalues[0], ...)
this code doesn't respect normalization failures, and may leave garbage in nvalues[0].
I guess this is because somebody assumed normalization can't fail here, because the value has already been normalized during dnPrettyNormal. But ... normalization can fail at least because some normalizators do not abort() on memory allocation failures.
Here is a patch that fixes these defects. Please, consider.
https://bugs.openldap.org/show_bug.cgi?id=9420
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.4.57
--- Comment #1 from Quanah Gibson-Mount quanah@openldap.org --- https://git.openldap.org/openldap/openldap/-/merge_requests/210
https://bugs.openldap.org/show_bug.cgi?id=9420
--- Comment #2 from Quanah Gibson-Mount quanah@openldap.org --- trunk:
Commits: • d28e231a by Quanah Gibson-Mount at 2020-12-08T16:05:35+00:00 ITS#9420 - Fix memory leak in modrdn
https://bugs.openldap.org/show_bug.cgi?id=9420
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Quanah Gibson-Mount quanah@openldap.org --- RE24:
Commits: • d959e946 by Quanah Gibson-Mount at 2020-12-08T17:09:59+00:00 ITS#9420 - Fix memory leak in modrdn
https://bugs.openldap.org/show_bug.cgi?id=9420
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED