From 7905cd6a2eddbf264242bb2a85f811878b2da7ab Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Sat, 9 Feb 2013 00:43:35 -0500 Subject: Add and use k5memdup, k5memdup0 helpers Add k5-int.h static functions to duplicate byte ranges, optionally with a trailing zero byte, and set an error code like k5alloc does. Use them where they would shorten existing code. --- src/plugins/preauth/pkinit/pkinit_srv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/preauth') diff --git a/src/plugins/preauth/pkinit/pkinit_srv.c b/src/plugins/preauth/pkinit/pkinit_srv.c index 132eef665..e37938211 100644 --- a/src/plugins/preauth/pkinit/pkinit_srv.c +++ b/src/plugins/preauth/pkinit/pkinit_srv.c @@ -639,11 +639,11 @@ pkinit_pick_kdf_alg(krb5_context context, krb5_data **kdf_list, tmp_oid = k5alloc(sizeof(krb5_data), &retval); if (retval) goto cleanup; - tmp_oid->data = k5alloc(supp_oid->length, &retval); + tmp_oid->data = k5memdup(supp_oid->data, supp_oid->length, + &retval); if (retval) goto cleanup; tmp_oid->length = supp_oid->length; - memcpy(tmp_oid->data, supp_oid->data, tmp_oid->length); *alg_oid = tmp_oid; /* don't free the OID in clean-up if we are returning it */ tmp_oid = NULL; -- cgit