alloc.c contains a function called xcalloc, which is like xmalloc except that
it initialises it's memory to zero.  

I suggest that we 

1.  Rename xcalloc to something like zmalloc.

2.  Implement an xcalloc function which wraps calloc, in the same way that
    xmalloc wraps malloc. 

3.  Prefer the new xcalloc where appropriate.  Ie: rather than:

        xmalloc(n_things * sizeof *things);

    use

        xcalloc(n_things, sizeof *things);

    The former raises the possibility of integer overflow and hence buffer 
    overrun.  In the latter case, we have more opportunity for bounds checking.


        





-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: signature.asc
Description: Digital signature

_______________________________________________
pspp-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/pspp-dev

Reply via email to