From 6b8b4e4d8320d8c9daf9410175c40a09e58c4868 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 6 May 2016 11:08:48 -0400 Subject: [PATCH] Fix pgbench's parsing of double values to notice trailing garbage. Noted by Fabien Coelho, though this isn't exactly his proposed patch. (The technique used here is borrowed from the zic sources.) --- src/bin/pgbench/pgbench.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index a4841656fa..f3c1a0e415 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -928,8 +928,9 @@ makeVariableNumeric(Variable *var) else /* type should be double */ { double dv; + char xs; - if (sscanf(var->value, "%lf", &dv) != 1) + if (sscanf(var->value, "%lf%c", &dv, &xs) != 1) { fprintf(stderr, "malformed variable \"%s\" value: \"%s\"\n",