From 50259a13298d1a62baf179452e5e3552fa4e4bd3 Mon Sep 17 00:00:00 2001 From: Matias Devenuta Date: Thu, 18 Feb 2016 17:43:55 -0300 Subject: [PATCH] Fix UnityPrintFloat() buffer overflow UnityPrintFloat() overflowed with some inputs (eg. FLT_MAX) --- src/unity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unity.c b/src/unity.c index c0593ce..45e34ea 100644 --- a/src/unity.c +++ b/src/unity.c @@ -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