Hi Yann,

Am 11.08.2016 um 23:07 schrieb Yann Ylavic:
On Thu, Aug 11, 2016 at 11:01 PM,  <rj...@apache.org> wrote:

+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+
+static void ssl_util_thr_id(CRYPTO_THREADID *id)
+{
+    /* OpenSSL needs this to return an unsigned long.  On OS/390, the pthread
+     * id is a structure twice that big.  Use the TCB pointer instead as a
+     * unique unsigned long.
+     */
+#ifdef __MVS__
+    struct PSA {
+        char unmapped[540];
+        unsigned long PSATOLD;
+    } *psaptr = 0;
+
+    CRYPTO_THREADID_set_numeric(id, psaptr->PSATOLD);

You really mean to dereference NULL here?

That was just a test if anyone is following.

No, seriously: good question, for me an opportunity to learn something new. The code was taken from trunk as-is (lame excuse), but it seems on z/OS NULL is not the same as address 0. The PSA (Prefixed Save Area) actually starts at address 0!

As info resources I have found:

http://www.longpelaexpertise.com.au/ezine/CtBlksBeginners2.php

which contains a snippet of C code

struct psa *psa_ptr = 0;           /* PSA is at address 0   */

and

https://www.ibm.com/support/knowledgecenter/SSGMGV_3.1.0/com.ibm.cics.ts31.doc/dfht3/dfht365.htm

which also seems to document, that PSA starts at address 0. So if we think those sources are reliable, I can add a small comment like the above "PSA is at address 0". Fascinating world of cross-platform compatibility.

And now that I did some more searches I found

https://bz.apache.org/bugzilla/show_bug.cgi?id=56210

"Possible null deference in apache/modules/ssl/ssl_util.c" which was closed by Mike Rumph as "RESOLVED INVALID" with the same arguments. So I should really add that comment.

Thanks for watching closely!

Regards,

Rainer

Reply via email to