summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSverker Eriksson <sverker@erlang.org>2018-01-12 15:33:12 +0100
committerSverker Eriksson <sverker@erlang.org>2018-01-15 17:25:11 +0100
commita8aeed346d0be42161a2563a09a4745b40d330ee (patch)
treee0d441ad65308d664eb63854d0792194f07d86bd
parent19b7ccfe076d88a96b62f3222f38be31bb087df2 (diff)
downloaderlang-a8aeed346d0be42161a2563a09a4745b40d330ee.tar.gz
erts: Fix buffer overflow bug in erts_printf %f
Sign character was not accounted for. Ex: float_to_list(-3.1265538967899625e+69, [{decimals,16}]).
-rw-r--r--erts/lib_src/common/erl_printf_format.c2
1 files changed, 1 insertions, 1 deletions
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;