summaryrefslogtreecommitdiffstats
path: root/krb5-1.4.1-api.patch
blob: d795f548cd4496c47c0dc721726490eabc8ed8f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;