From 997d82648527cf03c150c392231432c1c5dc97b2 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 22 Jan 2009 06:34:14 +0000 Subject: [PATCH] If USE_VALGRIND, check that source principal is defined before copying. Initialize magic number fields of allocated name components. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21775 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kadm5/srv/svr_principal.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/kadm5/srv/svr_principal.c b/src/lib/kadm5/srv/svr_principal.c index de11acd7e..2bdc1f5b2 100644 --- a/src/lib/kadm5/srv/svr_principal.c +++ b/src/lib/kadm5/srv/svr_principal.c @@ -24,6 +24,12 @@ static char *rcsid = "$Header$"; #endif +#ifdef USE_VALGRIND +#include +#else +#define VALGRIND_CHECK_DEFINED(LVALUE) ((void)0) +#endif + extern krb5_principal master_princ; extern krb5_principal hist_princ; extern krb5_keyblock master_keyblock; @@ -47,6 +53,7 @@ kadm5_copy_principal(krb5_context context, krb5_const_principal inprinc, krb5_pr if (tempprinc == 0) return ENOMEM; + VALGRIND_CHECK_DEFINED(*inprinc); memcpy(tempprinc, inprinc, sizeof(krb5_principal_data)); nelems = (int) krb5_princ_size(context, inprinc); @@ -70,6 +77,7 @@ kadm5_copy_principal(krb5_context context, krb5_const_principal inprinc, krb5_pr if (len) memcpy(krb5_princ_component(context, tempprinc, i)->data, krb5_princ_component(context, inprinc, i)->data, len); + krb5_princ_component(context, tempprinc, i)->magic = KV5M_DATA; } tempprinc->realm.data = -- 2.26.2