Fix UnityPrintFloat() buffer overflow

UnityPrintFloat() overflowed with some inputs (eg. FLT_MAX)
This commit is contained in:
Matias Devenuta
2016-02-18 17:43:55 -03:00
parent f31667ad18
commit 50259a1329

View File

@@ -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