diff options
author | Andy Polyakov <appro@openssl.org> | 2018-07-20 13:19:11 +0200 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2018-07-25 16:37:25 +0200 |
commit | 9e4a1c3f65863b0175ddc534e232e63c4f82ea5c (patch) | |
tree | 899e2c458e0dc33e4710522d2e46ff8afa919acd /crypto/cryptlib.c | |
parent | crypto/cryptlib.c: make OPENSS_cpuid_setup safe to use as constructor. (diff) | |
download | openssl-9e4a1c3f65863b0175ddc534e232e63c4f82ea5c.tar.xz openssl-9e4a1c3f65863b0175ddc534e232e63c4f82ea5c.zip |
crypto/cryptlib.c: resolve possible race in OPENSSL_isservice.
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/6752)
Diffstat (limited to 'crypto/cryptlib.c')
-rw-r--r-- | crypto/cryptlib.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index ad727edf6a..a7894ddac3 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -205,10 +205,14 @@ int OPENSSL_isservice(void) if (_OPENSSL_isservice.p == NULL) { HANDLE mod = GetModuleHandle(NULL); + FARPROC f; + if (mod != NULL) - _OPENSSL_isservice.f = GetProcAddress(mod, "_OPENSSL_isservice"); - if (_OPENSSL_isservice.p == NULL) + f = GetProcAddress(mod, "_OPENSSL_isservice"); + if (f == NULL) _OPENSSL_isservice.p = (void *)-1; + else + _OPENSSL_isservice.f = f; } if (_OPENSSL_isservice.p != (void *)-1) |