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


Please note the following change to our coding conventions:

Initialize pointers

All pointer variables MUST be initialized to NULL. History has
demonstrated that uninitialized pointer variables have lead to various
bugs and security issues.

Pointers MUST be initialized even if the assignment directly follows
the declaration, like pointer2 in the example below, because the
instructions sequence may change over time.

Good Example:

    char *pointer1 = NULL;
    char *pointer2 = NULL;

    pointer2 = some_func2();


    pointer1 = some_func1();

Shamelessly stolen from the Samba project ;-)

We've added this in Samba after one of the last Security bugs we had ...



Andreas Schneider                   GPG-ID: CC014E3D
www.cryptomilk.org                asn@xxxxxxxxxxxxxx

Archive administrator: postmaster@lists.cynapses.org