From 6d38cab0b686e49b3a72e02e29099cd491e052cb Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Wed, 5 Nov 2008 16:19:01 +0000 Subject: Convert many uses of strcpy/strcat (and sometimes sprintf) to accepted string-handling functions. ticket: 6200 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21001 dc483132-0cff-0310-8789-dd5450dbe970 --- src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/plugins/kdb') diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c index f95105678a..f3cf219cad 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c +++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c @@ -125,16 +125,16 @@ krb5_ldap_readpassword(context, ldap_context, password) /* Check if the entry has the path of a certificate */ if (!strncmp(start, "{FILE}", strlen("{FILE}"))) { /* Set *password = {FILE}\0 */ - /*ptr = strchr(start, ':'); - if (ptr == NULL) { */ - *password = (unsigned char *)malloc(strlen(start) + 2); + size_t len = strlen(start); + + *password = (unsigned char *)malloc(len + 2); if (*password == NULL) { st = ENOMEM; goto rp_exit; } - (*password)[strlen(start) + 1] = '\0'; - (*password)[strlen(start)] = '\0'; - strcpy((char *)(*password), start); + memcpy((char *)(*password), start, len); + (*password)[len] = '\0'; + (*password)[len + 1] = '\0'; goto got_password; } else { CT.value = (unsigned char *)start; -- cgit