svn rev #21775: trunk/src/lib/kadm5/srv/

raeburn@MIT.EDU raeburn at MIT.EDU
Thu Jan 22 01:34:16 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=21775
Commit By: raeburn
Log Message:
If USE_VALGRIND, check that source principal is defined before copying.
Initialize magic number fields of allocated name components.



Changed Files:
U   trunk/src/lib/kadm5/srv/svr_principal.c
Modified: trunk/src/lib/kadm5/srv/svr_principal.c
===================================================================
--- trunk/src/lib/kadm5/srv/svr_principal.c	2009-01-22 06:30:08 UTC (rev 21774)
+++ trunk/src/lib/kadm5/srv/svr_principal.c	2009-01-22 06:34:14 UTC (rev 21775)
@@ -24,6 +24,12 @@
 
 #endif
 
+#ifdef USE_VALGRIND
+#include <valgrind/memcheck.h>
+#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 @@
     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 @@
         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 =




More information about the cvs-krb5 mailing list