summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/snprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/snprintf.c b/main/snprintf.c
index a8f7d75f60..fa5a07cc45 100644
--- a/main/snprintf.c
+++ b/main/snprintf.c
@@ -298,7 +298,7 @@ ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf)
while (p1 < &buf[NDIG])
*p++ = *p1++;
} else if (arg > 0) {
- while ((fj = arg * 10) < 1) {
+ while ((fj = arg * 10) < 1 && (r2 * -1) < ndigits) {
arg = fj;
r2--;
}