On 1/11/2017 10:32 AM, Stephan Mühlstrasser wrote:

OpenSSL does not support platforms where the memory representation of the
NULL pointer contains non-zero bytes. IIRC there are even tests for this.

Could someone from the OpenSSL team please explain the rationale for
this decision? What is the problem with using assignments with 0 or NULL
to initialize pointers?

I suspect that it was a shortcut, where they used memset() on an entire structure, and it hopefully set pointers to NULL.

What I pointed out is that if NULL is not all zeros, this breaks.

~~~  BTW ~~~

Compilers know this.  So

        char *ptr = NULL;

and

        char *ptr = 0;

are equivalent, even on platforms where NULL is not all zeros.

It's when you cast the ptr to an integer first that it fails.


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

Reply via email to