Debug(LDAP_DEBUG_TRACE, "ldap_init: HOME env is %s\n",
home, 0, 0);
#endif
- path = LDAP_MALLOC(strlen(home) + strlen(file) + 3);
+ path = LDAP_MALLOC(strlen(home) + strlen(file) + sizeof( LDAP_DIRSEP "."));
} else {
#ifdef NEW_LOGGING
LDAP_LOG ( CONFIG, ARGS, "openldap_init_w_userconf: HOME env is NULL\n",
/* we assume UNIX path syntax is used... */
/* try ~/file */
- sprintf(path, "%s%s%s", home, LDAP_DIRSEP, file);
+ sprintf(path, "%s" LDAP_DIRSEP "%s", home, file);
openldap_ldap_init_w_conf(path, 1);
/* try ~/.file */
- sprintf(path, "%s%s.%s", home, LDAP_DIRSEP, file);
+ sprintf(path, "%s" LDAP_DIRSEP ".%s", home, file);
openldap_ldap_init_w_conf(path, 1);
}
/*
* Open the ctype.dat file.
*/
- sprintf(path, "%s%sctype.dat", opath, LDAP_DIRSEP);
+ snprintf(path, sizeof path, "%s%sctype.dat", opath, LDAP_DIRSEP);
if ((out = fopen(path, "wb")) == 0)
return;
/*
* Open the case.dat file.
*/
- sprintf(path, "%s%scase.dat", opath, LDAP_DIRSEP);
+ snprintf(path, sizeof path, "%s%scase.dat", opath, LDAP_DIRSEP);
if ((out = fopen(path, "wb")) == 0)
return;
/*
* Open the comp.dat file.
*/
- sprintf(path, "%s%scomp.dat", opath, LDAP_DIRSEP);
+ sprintf(path, sizeof path, "%s%scomp.dat", opath, LDAP_DIRSEP);
if ((out = fopen(path, "wb")) == 0)
return;
/*
* Open the decomp.dat file.
*/
- sprintf(path, "%s%sdecomp.dat", opath, LDAP_DIRSEP);
+ snprintf(path, sizeof path, "%s%sdecomp.dat", opath, LDAP_DIRSEP);
if ((out = fopen(path, "wb")) == 0)
return;
/*
* Open the kdecomp.dat file.
*/
- sprintf(path, "%s%skdecomp.dat", opath, LDAP_DIRSEP);
+ snprintf(path, sizeof path, "%s%skdecomp.dat", opath, LDAP_DIRSEP);
if ((out = fopen(path, "wb")) == 0)
return;
/*
* Open the cmbcl.dat file.
*/
- sprintf(path, "%s%scmbcl.dat", opath, LDAP_DIRSEP);
+ snprintf(path, sizeof path, "%s%scmbcl.dat", opath, LDAP_DIRSEP);
if ((out = fopen(path, "wb")) == 0)
return;
/*
* Open the num.dat file.
*/
- sprintf(path, "%s%snum.dat", opath, LDAP_DIRSEP);
+ snprintf(path, sizeof path, "%s%snum.dat", opath, LDAP_DIRSEP);
if ((out = fopen(path, "wb")) == 0)
return;
CloseServiceHandle(schService);
CloseServiceHandle(schSCManager);
- sprintf( regpath, "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s",
+ snprintf( regpath, sizeof regpath,
+ "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s",
lpszServiceName );
/* Create the registry key for event logging to the Windows NT event log. */
if ( RegCreateKeyEx(HKEY_LOCAL_MACHINE,
DWORD valLen = sizeof( vValue );
if ( svc != NULL )
- sprintf ( path, "SOFTWARE\\%s", svc );
+ snprintf ( path, sizeof path, "SOFTWARE\\%s", svc );
else
- strcpy (path, "SOFTWARE\\OpenLDAP\\Parameters" );
+ snprintf ( path, sizeof path, "SOFTWARE\\OpenLDAP\\Parameters" );
if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, path, 0, KEY_READ, &hkey ) != ERROR_SUCCESS )
{