X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_info.c;h=a48df516a3b780aa5d21e2c1d7f44fa315344317;hb=7d66dc1a93ed5d717b147e3ee52ff987408a98c3;hp=5bfe9ffe4428ec13aac2f20c6983724b1fdb61d7;hpb=622adf9826b98d3982278c57ab9a0f8fc6041b03;p=rrdtool.git diff --git a/src/rrd_info.c b/src/rrd_info.c index 5bfe9ff..a48df51 100644 --- a/src/rrd_info.c +++ b/src/rrd_info.c @@ -1,5 +1,5 @@ /***************************************************************************** - * RRDtool 1.2.99907080300 Copyright by Tobi Oetiker, 1997-2007 + * RRDtool 1.3rc6 Copyright by Tobi Oetiker, 1997-2008 ***************************************************************************** * rrd_info Get Information about the configuration of an RRD *****************************************************************************/ @@ -20,18 +20,14 @@ char *sprintf_alloc( char *fmt, ...) { -#ifdef HAVE_VSNPRINTF - int maxlen = 50; -#else - int maxlen = 1000; -#endif + int maxlen = 1024 + strlen(fmt); char *str = NULL; va_list argp; - str = malloc(sizeof(char) * (strlen(fmt) + maxlen)); + str = malloc(sizeof(char) * (maxlen+1)); if (str != NULL) { va_start(argp, fmt); #ifdef HAVE_VSNPRINTF - vsnprintf(str, maxlen - 1, fmt, argp); + vsnprintf(str, maxlen, fmt, argp); #else vsprintf(str, fmt, argp); #endif