kadm5 ad backend wrong size memset

Originally by Christos Zoulas.
This commit is contained in:
Nicolas Williams
2017-01-31 11:33:13 -06:00
committed by Viktor Dukhovni
parent 936017e4d6
commit 369945f5bc

View File

@@ -1286,21 +1286,21 @@ kadm5_ad_randkey_principal(void *server_handle,
return ret; return ret;
} }
krb5_data_zero (&result_code_string); krb5_data_zero(&result_code_string);
krb5_data_zero (&result_string); krb5_data_zero(&result_string);
ret = krb5_set_password_using_ccache (context->context, ret = krb5_set_password_using_ccache(context->context,
context->ccache, context->ccache,
password, password,
principal, principal,
&result_code, &result_code,
&result_code_string, &result_code_string,
&result_string); &result_string);
krb5_data_free(&result_code_string);
krb5_data_free(&result_string);
krb5_data_free (&result_code_string); if (ret)
krb5_data_free (&result_string); goto out;
if (ret == 0) {
*keys = malloc(sizeof(**keys) * 1); *keys = malloc(sizeof(**keys) * 1);
if (*keys == NULL) { if (*keys == NULL) {
@@ -1314,17 +1314,16 @@ kadm5_ad_randkey_principal(void *server_handle,
password, password,
principal, principal,
&(*keys)[0]); &(*keys)[0]);
memset(password, 0, sizeof(password));
if (ret) { if (ret) {
free(*keys); free(*keys);
*keys = NULL; *keys = NULL;
*n_keys = 0; *n_keys = 0;
goto out; goto out;
} }
}
out:
memset(password, 0, plen); memset(password, 0, plen);
free(password); free(password);
out:
return ret; return ret;
#else #else
*keys = NULL; *keys = NULL;