about summary refs log tree commit diff
path: root/misc/efgcvt_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc/efgcvt_r.c')
-rw-r--r--misc/efgcvt_r.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/misc/efgcvt_r.c b/misc/efgcvt_r.c
index 80770e6a82..1a039efc0b 100644
--- a/misc/efgcvt_r.c
+++ b/misc/efgcvt_r.c
@@ -101,7 +101,8 @@ APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
 
   n = __snprintf (buf, len, "%.*" FLOAT_FMT_FLAG "f", MIN (ndigit, NDIGIT_MAX),
 		  value);
-  if (n < 0)
+  /* Check for a too small buffer.  */
+  if (n >= len)
     return -1;
 
   i = 0;