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.)
This commit is contained in:
Tom Lane 2016-05-06 11:08:48 -04:00
parent 9515299485
commit 6b8b4e4d83
1 changed files with 2 additions and 1 deletions

View File

@ -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",