31 lines
1.1 KiB
Diff
31 lines
1.1 KiB
Diff
|
Reference docs don't define what happens if you call krb5_realm_compare() with
|
||
|
malformed krb5_principal structures. Define a behavior which keeps it from
|
||
|
crashing if applications don't check ahead of time.
|
||
|
|
||
|
--- krb5-1.4.1/src/lib/krb5/krb/princ_comp.c 2002-09-02 21:13:46.000000000 -0400
|
||
|
+++ krb5-1.4.1/src/lib/krb5/krb/princ_comp.c 2005-06-29 13:56:55.000000000 -0400
|
||
|
@@ -33,6 +33,13 @@
|
||
|
krb5_boolean KRB5_CALLCONV
|
||
|
krb5_realm_compare(krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2)
|
||
|
{
|
||
|
+ if ((princ1 == NULL) || (princ2 == NULL))
|
||
|
+ return FALSE;
|
||
|
+
|
||
|
+ if ((krb5_princ_realm(context, princ1) == NULL) ||
|
||
|
+ (krb5_princ_realm(context, princ2) == NULL))
|
||
|
+ return FALSE;
|
||
|
+
|
||
|
if (krb5_princ_realm(context, princ1)->length !=
|
||
|
krb5_princ_realm(context, princ2)->length ||
|
||
|
memcmp (krb5_princ_realm(context, princ1)->data,
|
||
|
@@ -49,6 +56,9 @@
|
||
|
register int i;
|
||
|
krb5_int32 nelem;
|
||
|
|
||
|
+ if ((princ1 == NULL) || (princ2 == NULL))
|
||
|
+ return FALSE;
|
||
|
+
|
||
|
nelem = krb5_princ_size(context, princ1);
|
||
|
if (nelem != krb5_princ_size(context, princ2))
|
||
|
return FALSE;
|