diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-05-06 11:08:48 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-05-06 11:08:48 -0400 |
commit | 6b8b4e4d8320d8c9daf9410175c40a09e58c4868 (patch) | |
tree | e77450cca22caa3d9b0e205e8a1584cf5e7c8ccc | |
parent | 9515299485a591b3a8f03c118d11809d01663665 (diff) | |
download | postgresql-6b8b4e4d8320d8c9daf9410175c40a09e58c4868.tar.gz postgresql-6b8b4e4d8320d8c9daf9410175c40a09e58c4868.zip |
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.)
-rw-r--r-- | src/bin/pgbench/pgbench.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index a4841656fa5..f3c1a0e4159 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", |