Don't use memcmp for comparing structures of values
authorKen Raeburn <raeburn@mit.edu>
Thu, 7 Aug 2008 18:37:27 +0000 (18:37 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 7 Aug 2008 18:37:27 +0000 (18:37 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20634 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/ccache/cc_retr.c

index d6bdaca5bb605aa35b5d1c45fc6b9c09f20bf127..1e25a048c198024b9f51fe7f3974ca0fd4d39a7a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * lib/krb5/ccache/cc_retr.c
  *
- * Copyright 1990,1991,1999,2007 by the Massachusetts Institute of Technology.
+ * Copyright 1990,1991,1999,2007,2008 by the Massachusetts Institute of Technology.
  * All Rights Reserved.
  *
  * Export of this software from the United States of America may
 
 #define set(bits) (whichfields & bits)
 #define flags_match(a,b) (((a) & (b)) == (a))
-#define times_match_exact(t1,t2) (memcmp((char *)(t1), (char *)(t2), sizeof(*(t1))) == 0)
+
+static int
+times_match_exact(const krb5_ticket_times *t1, const krb5_ticket_times *t2)
+{
+    return (t1->authtime == t2->authtime &&
+           t1->starttime == t2->starttime &&
+           t1->endtime == t2->endtime &&
+           t1->renew_till == t2->renew_till);
+}
 
 static krb5_boolean
 times_match(const krb5_ticket_times *t1, const krb5_ticket_times *t2)