[openssl] OpenSSL_1_1_1-stable update
bernd.edlinger at hotmail.de
bernd.edlinger at hotmail.de
Tue Jun 18 11:59:17 UTC 2019
The branch OpenSSL_1_1_1-stable has been updated
via 2459dc1bd09468c83f1767b6b6a1ddc45ba60d36 (commit)
from 10bf5068190ab25324648dd4a0becd4bd46ecc37 (commit)
- Log -----------------------------------------------------------------
commit 2459dc1bd09468c83f1767b6b6a1ddc45ba60d36
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date: Fri Jun 14 14:48:37 2019 +0200
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 at oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9163)
(cherry picked from commit e7a4682d0b347f0dfba629f4601a28801e54ad67)
-----------------------------------------------------------------------
Summary of changes:
crypto/o_str.c | 2 +-
crypto/store/loader_file.c | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/crypto/o_str.c b/crypto/o_str.c
index 1dbd70d..9ad7a89 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.
diff --git a/crypto/store/loader_file.c b/crypto/store/loader_file.c
index 632e451..1ebbe9f 100644
--- a/crypto/store/loader_file.c
+++ b/crypto/store/loader_file.c
@@ -860,10 +860,10 @@ static OSSL_STORE_LOADER_CTX *file_open(const OSSL_STORE_LOADER *loader,
if (ctx->_.dir.last_entry == NULL) {
if (ctx->_.dir.last_errno != 0) {
char errbuf[256];
- errno = ctx->_.dir.last_errno;
- openssl_strerror_r(errno, errbuf, sizeof(errbuf));
OSSL_STOREerr(OSSL_STORE_F_FILE_OPEN, ERR_R_SYS_LIB);
- ERR_add_error_data(1, errbuf);
+ errno = ctx->_.dir.last_errno;
+ if (openssl_strerror_r(errno, errbuf, sizeof(errbuf)))
+ ERR_add_error_data(1, errbuf);
goto err;
}
ctx->_.dir.end_reached = 1;
@@ -1260,11 +1260,11 @@ static OSSL_STORE_INFO *file_load(OSSL_STORE_LOADER_CTX *ctx,
if (!ctx->_.dir.end_reached) {
char errbuf[256];
assert(ctx->_.dir.last_errno != 0);
+ OSSL_STOREerr(OSSL_STORE_F_FILE_LOAD, ERR_R_SYS_LIB);
errno = ctx->_.dir.last_errno;
ctx->errcnt++;
- openssl_strerror_r(errno, errbuf, sizeof(errbuf));
- OSSL_STOREerr(OSSL_STORE_F_FILE_LOAD, ERR_R_SYS_LIB);
- ERR_add_error_data(1, errbuf);
+ if (openssl_strerror_r(errno, errbuf, sizeof(errbuf)))
+ ERR_add_error_data(1, errbuf);
}
return NULL;
}
More information about the openssl-commits
mailing list