]> jfr.im git - solanum.git/commit
openssl: Avoid use-after-free when rehashing fails to load new files
authorAaron Jones <redacted>
Fri, 12 Aug 2016 13:34:13 +0000 (13:34 +0000)
committerAaron Jones <redacted>
Fri, 12 Aug 2016 13:34:13 +0000 (13:34 +0000)
commitadd3f90b9ff26824149c6e6cd132bffa54adbe71
tree2bcd11c9b756aec37e00123f0ee67a4abd9af89c
parente5b5dc997da848a5f093053d199fde6c9e9f48be
openssl: Avoid use-after-free when rehashing fails to load new files

Commit cf12678 introduced a fix for issue #186 by freeing the old SSL_CTX
structure before constructing a new one, which could disconnect existing
clients otherwise.

Unfortunately, the freeing is done first, which means that if setting up
a new structure fails for any reason, there will be no usable structures
left, but they are still referenced.

This fix moves the freeing to the end of the function, using intermediate
new variables in the meantime. This problem was discovered while testing
against OpenSSL 1.1.0 RC6.
librb/src/openssl.c