[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KDC core dumping on Solaris 7



Graeme Wood <jaw@ucs.ed.ac.uk> writes:
> I am having problems running version 0.2q of heimdal. It compiles and the
> kdc will startup ok but if I try to use kpasswd or use kadmin in non-local
> mode, the kdc dies with an alignment error and dumps core. A stack trace
> shows the problem to be in a call to malloc from der_get_octet_string. Has
> anyone got any ideas what I am doing wrong?

You're not doing anything wrong.  But this might be the error that
Brandon S. Allbery discovered.  Can you try to apply the appended
patch and tell us if you still see the problem or not?  Thanks.

/assar

Index: connect.c
===================================================================
RCS file: /afs/pdc.kth.se/src/packages/kth-krb/SourceRepository/heimdal/kdc/connect.c,v
retrieving revision 1.72
diff -u -w -u -w -r1.72 connect.c
--- connect.c	2000/02/22 22:43:44	1.72
+++ connect.c	2000/03/29 20:34:16
@@ -208,6 +208,19 @@
 }
 
 /*
+ * re-intialize all `n' ->sa in `d'.
+ */
+
+static void
+reinit_descrs (struct descr *d, int n)
+{
+    int i;
+
+    for (i = 0; i < n; ++i)
+	d[i].sa = (struct sockaddr *)&d[i].__ss;
+}
+
+/*
  * Create the socket (family, type, port) in `d'
  */
 
@@ -318,6 +331,7 @@
     d = realloc(d, num * sizeof(*d));
     if (d == NULL && num != 0)
 	krb5_errx(context, 1, "realloc(%u) failed", num * sizeof(*d));
+    reinit_descrs (d, num);
     *desc = d;
     return num;
 }
@@ -561,7 +575,7 @@
     krb5_ret_int32(sp, &len);
     krb5_storage_free(sp);
     if(d->len - 4 >= len) {
-	memcpy(d->buf, d->buf + 4, d->len - 4);
+	memmove(d->buf, d->buf + 4, d->len - 4);
 	return 1;
     }
     return 0;
@@ -737,6 +751,7 @@
 		krb5_warnx(context, "No memory");
 	    else{
 		d = tmp;
+		reinit_descrs (d, ndescr);
 		memset(d + ndescr, 0, 4 * sizeof(*d));
 		for(i = ndescr; i < ndescr + 4; i++)
 		    init_descr (&d[i]);