From 912438dde5babdd04acf062d9aef45fa0ac1c1c2 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Tue, 4 Apr 2017 01:54:53 +1000 Subject: Implement a thread-safe strerror for windows --- src/openssl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') 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); -- cgit v1.2.3-59-g8ed1b