BUG/MAJOR: ssl: OpenSSL context is stored in non-reserved memory slot
authorThierry FOURNIER <thierry.fournier@ozon.io>
Sun, 17 Jun 2018 19:37:05 +0000 (21:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 18 Jun 2018 08:32:14 +0000 (10:32 +0200)
commit28962c994131d0fa15e2a9f948492eefc68a0d92
tree1a0f901c3c69ee42f86e1a474674d42df6cf8f71
parent16ff050478ab94d5147a4603fbd942a7f931c023
BUG/MAJOR: ssl: OpenSSL context is stored in non-reserved memory slot

We never saw unexplicated crash with SSL, so I suppose that we are
luck, or the slot 0 is always reserved. Anyway the usage of the macro
SSL_get_app_data() and SSL_set_app_data() seem wrong. This patch change
the deprecated functions SSL_get_app_data() and SSL_set_app_data()
by the new functions SSL_get_ex_data() and SSL_set_ex_data(), and
it reserves the slot in the SSL memory space.

For information, this is the two declaration which seems wrong or
incomplete in the OpenSSL ssl.h file. We can see the usage of the
slot 0 whoch is hardcoded, but never reserved.

   #define SSL_set_app_data(s,arg)     (SSL_set_ex_data(s,0,(char *)arg))
   #define SSL_get_app_data(s)      (SSL_get_ex_data(s,0))

This patch must be backported at least in 1.8, maybe in other versions.
src/ssl_sock.c