[openssl] master update
Dr. Paul Dale
pauli at openssl.org
Wed May 19 12:12:32 UTC 2021
The branch master has been updated
via cad4f3facc2ff5dce97b08b9ab8718783358b30c (commit)
from bf991b25caa6e915d858dd56c98ee774f248f03c (commit)
- Log -----------------------------------------------------------------
commit cad4f3facc2ff5dce97b08b9ab8718783358b30c
Author: Jake Cooke <jcooke2297 at outlook.com>
Date: Tue May 18 18:20:54 2021 +0930
Add bounds checking to length returned by wcslen in wide_to_asc conversion to resolve integer overflow flaw
Reviewed-by: Matt Caswell <matt at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15316)
-----------------------------------------------------------------------
Summary of changes:
engines/e_capi.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/engines/e_capi.c b/engines/e_capi.c
index dd66518d3f..2ea3cd2059 100644
--- a/engines/e_capi.c
+++ b/engines/e_capi.c
@@ -1120,10 +1120,19 @@ static char *wide_to_asc(LPCWSTR wstr)
{
char *str;
int len_0, sz;
+ size_t len_1;
if (!wstr)
return NULL;
- len_0 = (int)wcslen(wstr) + 1; /* WideCharToMultiByte expects int */
+
+ len_1 = wcslen(wstr) + 1;
+
+ if (len_1 > INT_MAX) {
+ CAPIerr(CAPI_F_WIDE_TO_ASC, CAPI_R_FUNCTION_NOT_SUPPORTED);
+ return NULL;
+ }
+
+ len_0 = (int)len_1; /* WideCharToMultiByte expects int */
sz = WideCharToMultiByte(CP_ACP, 0, wstr, len_0, NULL, 0, NULL, NULL);
if (!sz) {
CAPIerr(CAPI_F_WIDE_TO_ASC, CAPI_R_WIN32_ERROR);
More information about the openssl-commits
mailing list