[openssl-dev] [openssl-commits] [openssl] memset(0, ...) and NULL assignment

Viktor Dukhovni openssl-users at dukhovni.org
Thu Sep 3 20:40:54 UTC 2015


On Thu, Sep 03, 2015 at 03:34:38PM -0500, Benjamin Kaduk wrote:

> Interestingly, Viktor had just added some explicit NULL assignments
> after memset-to-zero a few days ago in
> a0724ef1c9b9e2090bdd96b784f492b6a3952957.  It is permitted for the NULL
> pointer to have a representation other than all-zeros, but such
> platforms are rare, and are explicitly excluded from the supported
> platforms list for, e.g., MIT krb5.  Does openssl want to try to support
> such platforms?

In Postfix, Wietse and I doggedly avoid relying on NULL being stored
as zero, whether or not any of our supported platforms violate
that.  Thus all pointers in malloced structures are initialized to
NULL explicitly.

So I tend to support the "general" case in other code I write.  I
would not have removed explicit NULL assignments, but if the project
explicitly disavows the exotic platorms, and we decide to optimize
out the redundant NULL assigments, I can live with that.

-- 
	Viktor.


More information about the openssl-dev mailing list