Use snprintf instead of sprintf (#2111)

This commit is contained in:
cat_mint 2020-12-01 09:59:27 -08:00 committed by GitHub
parent 5b1a6ae00a
commit 21c97f2fad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,7 +44,7 @@ namespace Catch {
#ifdef _MSC_VER #ifdef _MSC_VER
sprintf_s( buffer, "%.3f", duration ); sprintf_s( buffer, "%.3f", duration );
#else #else
std::sprintf( buffer, "%.3f", duration ); std::snprintf( buffer, maxDoubleSize, "%.3f", duration );
#endif #endif
return std::string( buffer ); return std::string( buffer );
} }