From 552bc9be1a7c05166310ae79fc3eea70967eebbb Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Mon, 6 Feb 2017 18:42:35 -0800 Subject: [PATCH 2/2] Ticket #49121 - ns-slapd crashes in ldif_sput due to the output buf size is less than the real size. Description: Calculating the size of entry in entry2str_internal_size_attrlist does not match the copy in entry2str_internal_put_attrlist? - if (valueset_isempty(&a->a_deleted_values)) { + if (valueset_isempty(&a->a_present_values)) { --- ldap/servers/slapd/entry.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c index 598eb66..e16d8c5 100644 --- a/ldap/servers/slapd/entry.c +++ b/ldap/servers/slapd/entry.c @@ -1515,7 +1515,7 @@ entry2str_internal_size_attrlist( const Slapi_Attr *attrlist, int entry2str_ctrl { elen += 1 + LDIF_CSNPREFIX_MAXLENGTH + CSN_STRSIZE; } - if ( valueset_isempty(&a->a_deleted_values)) { + if (valueset_isempty(&a->a_present_values)) { /* this means the entry is deleted and has no more attributes, * when writing the attr to disk we would loose the AD-csn. * Add an empty value to the set of deleted values. This will @@ -1524,8 +1524,8 @@ entry2str_internal_size_attrlist( const Slapi_Attr *attrlist, int entry2str_ctrl * We need to add the size for that. */ elen += 1 + LDIF_CSNPREFIX_MAXLENGTH + CSN_STRSIZE; - /* need also space for ";deletedattribute;deleted" */ - elen += DELETED_ATTR_STRSIZE + DELETED_VALUE_STRSIZE; + /* need also space for ";deletedattribute;deleted" */ + elen += DELETED_ATTR_STRSIZE + DELETED_VALUE_STRSIZE; } } } -- 2.9.3