]> granicus.if.org Git - curl/commit
openssl: fix thread-safety bugs in error-handling
authorDavid Benjamin <davidben@google.com>
Mon, 17 Apr 2017 14:01:40 +0000 (10:01 -0400)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 17 Apr 2017 21:20:30 +0000 (23:20 +0200)
commit1c92b5b60957b26819c5f8a9f46412564d4c2cfe
treedbcab3af39ae6aa5c801698971e23cc4dd40ee79
parent47b2f89d7c7e1440a344e6e82a9390e0f912d2f8
openssl: fix thread-safety bugs in error-handling

ERR_error_string with NULL parameter is not thread-safe. The library
writes the string into some static buffer. Two threads doing this at
once may clobber each other and run into problems. Switch to
ERR_error_string_n which avoids this problem and is explicitly
bounds-checked.

Also clean up some remnants of OpenSSL 0.9.5 around here. A number of
comments (fixed buffer size, explaining that ERR_error_string_n was
added in a particular version) date to when ossl_strerror tried to
support pre-ERR_error_string_n OpenSSLs.

Closes #1424
lib/vtls/openssl.c