diff options
Diffstat (limited to 'thirdparty/mbedtls/1453.diff')
-rw-r--r-- | thirdparty/mbedtls/1453.diff | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/thirdparty/mbedtls/1453.diff b/thirdparty/mbedtls/1453.diff index 6630ad861f..b1c9c43ed2 100644 --- a/thirdparty/mbedtls/1453.diff +++ b/thirdparty/mbedtls/1453.diff @@ -1,8 +1,8 @@ diff --git a/library/entropy_poll.c b/library/entropy_poll.c -index 67900c46c8..cefe882d2a 100644 +index 4556f88a5..ba56b70f7 100644 --- a/library/entropy_poll.c +++ b/library/entropy_poll.c -@@ -54,28 +54,43 @@ +@@ -61,28 +61,43 @@ #define _WIN32_WINNT 0x0400 #endif #include <windows.h> @@ -54,7 +54,7 @@ index 67900c46c8..cefe882d2a 100644 return( 0 ); diff --git a/library/x509_crt.c b/library/x509_crt.c -index 290c1eb3d1..3cf1743821 100644 +index 76558342e..35a134950 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -65,6 +65,19 @@ @@ -77,20 +77,20 @@ index 290c1eb3d1..3cf1743821 100644 #else #include <time.h> #endif -@@ -1126,6 +1139,7 @@ int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path ) +@@ -1278,6 +1291,7 @@ int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path ) char filename[MAX_PATH]; char *p; size_t len = strlen( path ); -+ int length_as_int = 0; ++ int lengthAsInt = 0; WIN32_FIND_DATAW file_data; HANDLE hFind; -@@ -1140,7 +1154,18 @@ int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path ) +@@ -1292,7 +1306,18 @@ int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path ) p = filename + len; filename[len++] = '*'; - w_ret = MultiByteToWideChar( CP_ACP, 0, filename, (int)len, szDir, -+ if ( FAILED ( SizeTToInt( len, &length_as_int ) ) ) ++ if ( FAILED ( SizeTToInt( len, &lengthAsInt ) ) ) + return( MBEDTLS_ERR_X509_FILE_IO_ERROR ); + + /* @@ -101,20 +101,20 @@ index 290c1eb3d1..3cf1743821 100644 + * incoming string are less than MAX_PATH to avoid a buffer overrun with + * MultiByteToWideChar(). + */ -+ w_ret = MultiByteToWideChar( CP_ACP, 0, filename, length_as_int, szDir, ++ w_ret = MultiByteToWideChar( CP_ACP, 0, filename, lengthAsInt, szDir, MAX_PATH - 3 ); if( w_ret == 0 ) return( MBEDTLS_ERR_X509_BAD_INPUT_DATA ); -@@ -1157,8 +1182,11 @@ int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path ) +@@ -1309,8 +1334,11 @@ int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path ) if( file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) continue; -+ if ( FAILED( SizeTToInt( wcslen( file_data.cFileName ), &length_as_int ) ) ) ++ if ( FAILED( SizeTToInt( wcslen( file_data.cFileName ), &lengthAsInt ) ) ) + return( MBEDTLS_ERR_X509_FILE_IO_ERROR ); + w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName, - lstrlenW( file_data.cFileName ), -+ length_as_int, ++ lengthAsInt, p, (int) len - 1, NULL, NULL ); if( w_ret == 0 ) |