From 022bfb6db106a27d0c01899ae2944fa9c6df74b4 Mon Sep 17 00:00:00 2001 From: Rick L Bird Date: Fri, 6 May 2011 18:01:59 -0400 Subject: [PATCH] PennMUSH 1.8.3p11 Author: captdeaf@gmail.com Date: Tue Dec 22 21:41:11 2009 +0000 Fixed a crashbug in unparse_number reported by Ghost@M*U*S*H. Fixes #154 --- src/unparse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/unparse.c b/src/unparse.c index 00ba9c2..07c9280 100644 --- a/src/unparse.c +++ b/src/unparse.c @@ -286,7 +286,6 @@ unparse_uinteger(uintmax_t num) return str; } - /** Give a string representation of a number. * \param num value to stringify * \return address of static buffer containing stringified value. @@ -294,9 +293,10 @@ unparse_uinteger(uintmax_t num) char * unparse_number(NVAL num) { - static char str[100]; /* Should be large enough for even the HUGE floats */ + /* 100 is NOT large enough for even the huge floats */ + static char str[1000]; /* Should be large enough for even the HUGE floats */ char *p; - sprintf(str, "%.*f", FLOAT_PRECISION, num); + snprintf(str, 1000, "%.*f", FLOAT_PRECISION, num); if ((p = strchr(str, '.'))) { p += strlen(p); -- 2.30.2