1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

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
This commit is contained in:
Daniel Stenberg 2017-09-15 16:38:48 +02:00
parent 6d436642dd
commit 697271fc98
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -242,14 +242,16 @@ static ParameterError str2double(double *val, const char *str, long max)
* data. * 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) if(result != PARAM_OK)
return result; return result;
if(*val < 0) if(value < 0)
return PARAM_NEGATIVE_NUMERIC; return PARAM_NEGATIVE_NUMERIC;
*valp = value;
return PARAM_OK; return PARAM_OK;
} }