mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-12-17 22:08:07 +08:00
Fix UnityPrintFloat() buffer overflow
UnityPrintFloat() overflowed with some inputs (eg. FLT_MAX)
This commit is contained in:
@@ -283,7 +283,7 @@ void UnityPrintMask(const _U_UINT mask, const _U_UINT number)
|
||||
void UnityPrintFloat(_UF number)
|
||||
{
|
||||
char TempBuffer[32];
|
||||
sprintf(TempBuffer, "%.6f", number);
|
||||
snprintf(TempBuffer, sizeof(TempBuffer), "%.6f", number);
|
||||
UnityPrint(TempBuffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user