Allocate enough space for tiny arguments. [jmk] --rw-rw-r-- M 284650 glenda sys 4490 Oct 26 20:52 sys/src/libc/fmt/fltfmt.c /n/sourcesdump/2005/1026/plan9/sys/src/libc/fmt/fltfmt.c:8,13 - /n/sourcesdump/2005/1027/plan9/sys/src/libc/fmt/fltfmt.c:8,14 FDIGIT = 30, FDEFLT = 6, NSIGNIF = 17, + NEXP10 = 308, }; static int /n/sourcesdump/2005/1026/plan9/sys/src/libc/fmt/fltfmt.c:294,301 - /n/sourcesdump/2005/1027/plan9/sys/src/libc/fmt/fltfmt.c:295,307 int _floatfmt(Fmt *fmt, double f) { - char s[FDIGIT+10]; + char s[1+NEXP10+1+FDIGIT+1]; + /* + * The max length of a %f string is + * '[+-]'+"max exponent"+'.'+"max precision"+'\0' + * which is 341 currently. + */ xdtoa(fmt, s, f); fmt->flags &= FmtWidth|FmtLeft; _fmtcpy(fmt, s, strlen(s), strlen(s));