File 0161-erts-Fix-buffer-overflow-bug-in-erts_printf-f.patch of Package erlang

From a8aeed346d0be42161a2563a09a4745b40d330ee Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Fri, 12 Jan 2018 15:33:12 +0100
Subject: [PATCH 1/3] erts: Fix buffer overflow bug in erts_printf %f

Sign character was not accounted for.

Ex:
float_to_list(-3.1265538967899625e+69, [{decimals,16}]).
---
 erts/lib_src/common/erl_printf_format.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/erts/lib_src/common/erl_printf_format.c b/erts/lib_src/common/erl_printf_format.c
index 3daa066fd3..3302083288 100644
--- a/erts/lib_src/common/erl_printf_format.c
+++ b/erts/lib_src/common/erl_printf_format.c
@@ -331,7 +331,7 @@ static int fmt_double(fmtfn_t fn,void*arg,double val,
     char *bufp = sbuf;
     double dexp;
     int exp;
-    size_t max_size = 1;
+    size_t max_size = 2;  /* including possible sign */
     int size;
     int new_fmt = fmt;
     int fpe_was_unmasked;
-- 
2.16.0

openSUSE Build Service is sponsored by