summaryrefslogtreecommitdiffstats
path: root/crypto/o_str.c
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2019-06-14 14:48:37 +0200
committerBernd Edlinger <bernd.edlinger@hotmail.de>2019-06-18 13:58:52 +0200
commit2459dc1bd09468c83f1767b6b6a1ddc45ba60d36 (patch)
tree096abf2ee446c164184e2aa7d3746bd90897c155 /crypto/o_str.c
parent10bf5068190ab25324648dd4a0becd4bd46ecc37 (diff)
Fix error handling at openssl_strerror_r
When bufsize == 0, openssl_strerror_r should return 0 (if _GNU_SOURCE is defined), to be consistent with non-_GNU_SOURCE variants, which exhibit the same behavior. Fix a few cases, where the return value of openssl_strerror_r was ignored. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9163) (cherry picked from commit e7a4682d0b347f0dfba629f4601a28801e54ad67)
Diffstat (limited to 'crypto/o_str.c')
-rw-r--r--crypto/o_str.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/o_str.c b/crypto/o_str.c
index 1dbd70d58c..9ad7a89dca 100644
--- a/crypto/o_str.c
+++ b/crypto/o_str.c
@@ -231,7 +231,7 @@ int openssl_strerror_r(int errnum, char *buf, size_t buflen)
* buf is left unused.
*/
err = strerror_r(errnum, buf, buflen);
- if (err == NULL)
+ if (err == NULL || buflen == 0)
return 0;
/*
* If err is statically allocated, err != buf and we need to copy the data.