The decimal() function was changed in r217808 to take the

maximum value instead of number of bits. But for case when
limitation is not needed it erroneously skips conversion to
number and always returns zero. So, don't skip conversion
for case when limitation is not needed.

PR:		bin/159765
Approved by:	re (kib)
This commit is contained in:
Andrey V. Elsukov 2011-08-19 12:48:06 +00:00
parent 15d837d8a0
commit 6bfcd9c37b

View File

@ -940,7 +940,7 @@ decimal(const char *str, int *num, int deflt, uint32_t maxval)
return 0;
while ((c = *cp++)) {
if (c <= '9' && c >= '0') {
if (maxval > 0 && acc <= maxval)
if (acc <= maxval || maxval == 0)
acc = acc * 10 + c - '0';
} else
break;