X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fvfprintf.c;h=f13fbe10576d157684ecfc9d4e8bcf448010cd6d;hb=ecc0f5138dd784eadea66f5b244515a98b381d39;hp=2245d1da5dedeed4eb698098c4faaf502b6c4597;hpb=f9569662c08d371b85c77f025dd5c6e00b4a4c8b;p=musl diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c index 2245d1da..f13fbe10 100644 --- a/src/stdio/vfprintf.c +++ b/src/stdio/vfprintf.c @@ -326,13 +326,15 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) if (x || d+1!=z) { long double round = CONCAT(0x1p,LDBL_MANT_DIG); long double small; - if (x 999999999) { *d--=0; (*d)++; @@ -341,6 +343,7 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) for (i=10, e=9*(r-a); *a>=i; i*=10, e++); } } + if (z>d+1) z=d+1; for (; !z[-1] && z>a; z--); } @@ -633,8 +636,8 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, int vfprintf(FILE *f, const char *fmt, va_list ap) { va_list ap2; - int nl_type[NL_ARGMAX] = {0}; - union arg nl_arg[NL_ARGMAX]; + int nl_type[NL_ARGMAX+1] = {0}; + union arg nl_arg[NL_ARGMAX+1]; unsigned char internal_buf[80], *saved_buf = 0; int ret;