Bug 181776

Summary: 64bit issues with normalize_path(), make_dn(), and add_aci_v()
Product: [Retired] 389 Reporter: Rich Megginson <rmeggins>
Component: Directory ServerAssignee: Rich Megginson <rmeggins>
Status: CLOSED CURRENTRELEASE QA Contact: Viktor Ashirov <vashirov>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0CC: amsharma
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: 1.0.2
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-07 16:58:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 183369    
Attachments:
Description Flags
list of files for fix
none
diffs for fix none

Description Rich Megginson 2006-02-16 14:48:08 UTC
1) normalize_path() does not allocate space for the char* array correctly.  It
should use slapi_ch_calloc with an elemsize of sizeof(char *) instead of 1.  I
guess we got lucky on 32 bit platforms where strlen(path) > (num dirs + 1) * 4.
 However, on a 64 bit platform, the 4 becomes an 8 and core dumps ensue.
2) make_dn() and add_aci_v() in cfg_sspt.c use a null terminated varargs list. 
The null terminator is a bare 0 which the gcc3 compiler assumes is an int.  This
blows up the varargs function where the 32bit 0 is cast to a 64bit char * with
garbage in it.

Comment 1 Rich Megginson 2006-02-16 14:48:09 UTC
Created attachment 124749 [details]
list of files for fix

Comment 2 Rich Megginson 2006-02-16 14:49:04 UTC
Created attachment 124750 [details]
diffs for fix

Comment 3 Rich Megginson 2006-02-16 17:35:45 UTC
Reviewed by: Nathan and Noriko (Thanks!)
Files: https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=124749
Branch: HEAD
Fix Description: 1) use sizeof(char *) as the elemsize to pass to 
slapi_ch_calloc(). 2) create a variable const char *NULLSTR = 0 to pass 
as the last argument to the varargs functions.
Platforms tested: RHEL4 64
Flag Day: no
Doc impact: no

Checking in ldapserver/ldap/admin/src/cfg_sspt.c;
/cvs/dirsec/ldapserver/ldap/admin/src/cfg_sspt.c,v  <--  cfg_sspt.c
new revision: 1.8; previous revision: 1.7
done
Checking in ldapserver/ldap/servers/slapd/util.c;
/cvs/dirsec/ldapserver/ldap/servers/slapd/util.c,v  <--  util.c
new revision: 1.10; previous revision: 1.9
done