aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2017-04-04 01:54:53 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2017-09-02 04:09:50 +1000
commit912438dde5babdd04acf062d9aef45fa0ac1c1c2 (patch)
tree97cf48363c948efa1ae3ed964ec3763827cb343f
parentfbb50a8888ce145e32b15a499c0c189bd51d94d3 (diff)
downloadluaossl-912438dde5babdd04acf062d9aef45fa0ac1c1c2.tar.gz
luaossl-912438dde5babdd04acf062d9aef45fa0ac1c1c2.tar.bz2
luaossl-912438dde5babdd04acf062d9aef45fa0ac1c1c2.zip
Implement a thread-safe strerror for windows
-rw-r--r--src/openssl.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 6e30726..5c47635 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -811,11 +811,10 @@ static const char *aux_strerror_r(int error, char *dst, size_t lim) {
size_t n;
#if _WIN32
- char *rv = strerror(error);
- n = MIN(strlen(rv) - 1, lim);
- memcpy(dst, rv, n);
- return dst;
+ errno_t rv = strerror_s(dst, lim, error);
+ if (rv)
+ return dst;
#elif STRERROR_R_CHAR_P
char *rv = strerror_r(error, dst, lim);