From 91dfcd5a5d2cb20285504d787ee4a6135303891a Mon Sep 17 00:00:00 2001
From: Jan Breuer <jan.breuer@jaybee.cz>
Date: 周日, 15 5月 2016 20:01:44 +0800
Subject: [PATCH] Fix buffer overflow in SCPI_NumberToStr, SCPI_DoubleToStr and SCPI_FloatToStr

---
 libscpi/inc/scpi/config.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libscpi/inc/scpi/config.h b/libscpi/inc/scpi/config.h
index 0abb9c2..7473d9d 100644
--- a/libscpi/inc/scpi/config.h
+++ b/libscpi/inc/scpi/config.h
@@ -246,17 +246,17 @@
 #endif
 
 #if HAVE_DTOSTRE
-#define SCPIDEFINE_floatToStr(v, s, l) strlen(dtostre((double)(v), (s), 6, DTOSTR_PLUS_SIGN | DTOSTR_ALWAYS_SIGN | DTOSTR_UPPERCASE))
+#define SCPIDEFINE_floatToStr(v, s, l) dtostre((double)(v), (s), 6, DTOSTR_PLUS_SIGN | DTOSTR_ALWAYS_SIGN | DTOSTR_UPPERCASE)
 #elif USE_CUSTOM_DTOSTRE
-#define SCPIDEFINE_floatToStr(v, s, l) strlen(SCPI_dtostre((v), (s), (l), 6, 0))
+#define SCPIDEFINE_floatToStr(v, s, l) SCPI_dtostre((v), (s), (l), 6, 0)
 #else
 #define SCPIDEFINE_floatToStr(v, s, l) snprintf((s), (l), "%g", (v))
 #endif
 
 #if HAVE_DTOSTRE
-#define SCPIDEFINE_doubleToStr(v, s, l) strlen(dtostre((v), (s), 15, DTOSTR_PLUS_SIGN | DTOSTR_ALWAYS_SIGN | DTOSTR_UPPERCASE))
+#define SCPIDEFINE_doubleToStr(v, s, l) dtostre((v), (s), 15, DTOSTR_PLUS_SIGN | DTOSTR_ALWAYS_SIGN | DTOSTR_UPPERCASE)
 #elif USE_CUSTOM_DTOSTRE
-#define SCPIDEFINE_doubleToStr(v, s, l) strlen(SCPI_dtostre((v), (s), (l), 15, 0))
+#define SCPIDEFINE_doubleToStr(v, s, l) SCPI_dtostre((v), (s), (l), 15, 0)
 #else
 #define SCPIDEFINE_doubleToStr(v, s, l) snprintf((s), (l), "%.15lg", (v))
 #endif

--
Gitblit v1.9.1