about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-06-20 09:28:54 -0400
committerRich Felker <dalias@aerifal.cx>2012-06-20 09:28:54 -0400
commit839bff64a17c1ecaed60feefd9b63554ca9cbad6 (patch)
tree9a0ea28627f10ff1e4b557bfd48408e05e5e52b3
parent82a4499e671db62fab1e3928de6e00bb109d4c8d (diff)
downloadmusl-839bff64a17c1ecaed60feefd9b63554ca9cbad6.tar.gz
musl-839bff64a17c1ecaed60feefd9b63554ca9cbad6.tar.xz
musl-839bff64a17c1ecaed60feefd9b63554ca9cbad6.zip
fix another oob pointer arithmetic issue in printf floating point
this one could never cause any problems unless the compiler/machine
goes to extra trouble to break oob pointer arithmetic, but it's best
to fix it anyway.
-rw-r--r--src/stdio/vfprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
index a3bf18dd..116e1ced 100644
--- a/src/stdio/vfprintf.c
+++ b/src/stdio/vfprintf.c
@@ -319,7 +319,7 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t)
 	if (j < 9*(z-r-1)) {
 		uint32_t x;
 		/* We avoid C's broken division of negative numbers */
-		d = r + 1 + (j+9*LDBL_MAX_EXP)/9 - LDBL_MAX_EXP;
+		d = r + 1 + ((j+9*LDBL_MAX_EXP)/9 - LDBL_MAX_EXP);
 		j += 9*LDBL_MAX_EXP;
 		j %= 9;
 		for (i=10, j++; j<9; i*=10, j++);