mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 16:55:42 +01:00
Tune up Windows snprintf() support
When we build with Visual Studio in debug mode, the invalid parameter handler aborts the application (and offers to debug it) when n is 0. We want to just return -1 instead (as calls with n == 0 are expected and happen in our tests).
This commit is contained in:
parent
fc36708697
commit
f659d2cd40
@ -70,6 +70,10 @@ int mbedtls_platform_win32_snprintf( char *s, size_t n, const char *fmt, ... )
|
||||
int ret;
|
||||
va_list argp;
|
||||
|
||||
/* Avoid calling the invalid parameter handler by checking ourselves */
|
||||
if( s == NULL || n == 0 || fmt == NULL )
|
||||
return( -1 );
|
||||
|
||||
va_start( argp, fmt );
|
||||
ret = _vsnprintf_s( s, n, _TRUNCATE, fmt, argp );
|
||||
va_end( argp );
|
||||
|
Loading…
Reference in New Issue
Block a user