diff options
Diffstat (limited to 'src/plugins/kdb')
| -rw-r--r-- | src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c | 12 |
1 files changed, 6 insertions, 6 deletions
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 f95105678..f3cf219ca 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}<path to cert>\0<cert password> */ - /*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; |
