Current-Users archive

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

Re: ipfstat dumps core on sparc - unaligned read?



Thanks - this patch is now a little gross, but I'm trying to make
minimal changes.

Index: dist/ipf/tools/ipfstat.c
===================================================================
RCS file: /cvsroot/src/dist/ipf/tools/ipfstat.c,v
retrieving revision 1.12.4.3
diff -u -p -r1.12.4.3 ipfstat.c
--- dist/ipf/tools/ipfstat.c    16 Jul 2007 11:05:32 -0000      1.12.4.3
+++ dist/ipf/tools/ipfstat.c    6 Mar 2009 19:06:32 -0000
@@ -792,6 +792,11 @@ char *group, *comment;
        frgroup_t *g;
        ipfobj_t obj;
        int n;
+       /* XXX Why is this size ok? */
+#define ARRAY_ELEMENTS 1000
+       size_t array_size = sizeof(u_long) * ARRAY_ELEMENTS;
+       u_long *array = calloc(sizeof(u_long), ARRAY_ELEMENTS);
+#undef ARRAY_ELEMENTS
 
        if (use_inet6 == 1)
                fb.fr_v = 6;
@@ -819,9 +824,7 @@ char *group, *comment;
        obj.ipfo_ptr = &rule;
 
        do {
-               u_long array[1000];
-
-               memset(array, 0xff, sizeof(array));
+               memset(array, 0xff, array_size);
                fp = (frentry_t *)array;
                rule.iri_rule = fp;
                if (ioctl(ipf_fd, SIOCIPFITER, &obj) == -1) {

Attachment: pgpETDNXixNAZ.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index