-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mbedtls_debug_print_mpi cause illegal access when MPI is empty #2723
Comments
@wjzhang Thank you for your report! |
Seems |
Fix for issue Mbed-TLS#2723
I confirm this bug when building libcurl with https://github.com/curl/curl/blob/master/lib/vtls/mbedtls.c#L515-L525: #ifdef MBEDTLS_DEBUG
/* In order to make that work in mbedtls MBEDTLS_DEBUG_C must be defined. */
mbedtls_ssl_conf_dbg(&backend->config, mbed_debug, data);
/* - 0 No debug
* - 1 Error
* - 2 State change
* - 3 Informational
* - 4 Verbose
*/
mbedtls_debug_set_threshold(4);
#endif Many (all?)
and Booms on the next debug-line I presume. I simply patched it into this to fix it: --- a/library/debug.c 2021-02-17 14:00:28
+++ b/library/debug.c 2021-02-17 15:25:07
@@ -231,6 +231,14 @@
return;
}
+ if (X->n <= 0)
+ {
+ debug_send_line( ssl, level, file, line, "X->n <= 0!!\n");
+ return;
+ }
+
for( n = X->n - 1; n > 0; n-- )
if( X->p[n] != 0 )
break; Doing a |
This was fixed as part of #4604, so closing |
Bug
the mbedtls_debug_print_mpi will cause illegal access when MPI point is empty.
void mbedtls_debug_print_mpi( const mbedtls_ssl_context *ssl, int level,
const char *file, int line,
const char *text, const mbedtls_mpi *X )
{
char str[DEBUG_BUF_SIZE];
int j, k, zeros = 1;
size_t i, n, idx = 0;
....
mbed TLS build:
Version: latest
The text was updated successfully, but these errors were encountered: