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?



With this fix, ipfstat runs ok on my NetBSD-4/sparc.  Without it,
'ipfstat -inh' gets a bus error, I think due to the u_long being not
aligned to 8 and faulting on a long long access.  Should I commit it to
current, or does Darren want to comment and/or fix it differently, or
file a PR, or ???

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 18:12:36 -0000
@@ -792,6 +792,8 @@ char *group, *comment;
        frgroup_t *g;
        ipfobj_t obj;
        int n;
+       /* XXX Why is this size ok? */
+       u_long *array = calloc(sizeof(u_long), 1000);
 
        if (use_inet6 == 1)
                fb.fr_v = 6;
@@ -819,8 +821,6 @@ char *group, *comment;
        obj.ipfo_ptr = &rule;
 
        do {
-               u_long array[1000];
-
                memset(array, 0xff, sizeof(array));
                fp = (frentry_t *)array;
                rule.iri_rule = fp;

Attachment: pgp6op7UQMJ2b.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index