[openssl-dev] [question] Useless NULL check or Missing NULL check?

Kurt Cancemi kurt at x64architecture.com
Sun May 17 19:13:13 UTC 2015


Hello,

If anyone from the openssl dev team can answer this question about the
openssl code:

In ssl_lib.c in SSL_shutdown(), s->handshake_func is compared against
0 (inferring that s != NULL)  and then there is a NULL check that (s
!= NULL) which the compiler optimizes out because (s) is inferred to
not be NULL because of the check (s->handshake_func == 0).

So is there supposed to be a NULL check before the check
(s->handshake_func == 0) or no?

Note: This behavior was changed in commit b31b04 in 1999.

---
Kurt Cancemi
https://www.x64architecture.com


More information about the openssl-dev mailing list