diff options
author | Daniel Stenberg <daniel@haxx.se> | 2017-09-15 16:38:48 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-09-18 10:45:29 +0200 |
commit | 697271fc980331ffb53f12850f82c80ed182a375 (patch) | |
tree | dd47e6134a5f8f903856618c657b5669c7e77f7d /src | |
parent | 6d436642ddfc30264d9f466b185dfe0683d0d551 (diff) | |
download | curl-697271fc980331ffb53f12850f82c80ed182a375.tar.gz |
curl: make str2udouble not return values on error
... previously it would store a return value even when it returned
error, which could make the value get used anyway!
Reported-by: Brian Carpenter
Closes #1893
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_paramhlp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index 42631e9c3..7cddf51ce 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -242,14 +242,16 @@ static ParameterError str2double(double *val, const char *str, long max) * data. */ -ParameterError str2udouble(double *val, const char *str, long max) +ParameterError str2udouble(double *valp, const char *str, long max) { - ParameterError result = str2double(val, str, max); + double value; + ParameterError result = str2double(&value, str, max); if(result != PARAM_OK) return result; - if(*val < 0) + if(value < 0) return PARAM_NEGATIVE_NUMERIC; + *valp = value; return PARAM_OK; } |