X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_info.c;h=13d30a6cd37fed0a5d70b3376882adaf7c68b1b5;hb=9cd66f2d7fbf16ca07e1709cd156ae78cd0da278;hp=6492cde41a520d08acae691ec1ec6dcad93d082d;hpb=e1c12d5c14b4a716ea999204cedb13e98466ff15;p=rrdtool.git diff --git a/src/rrd_info.c b/src/rrd_info.c index 6492cde..13d30a6 100644 --- a/src/rrd_info.c +++ b/src/rrd_info.c @@ -1,5 +1,5 @@ /***************************************************************************** - * RRDtool 1.3rc3 Copyright by Tobi Oetiker, 1997-2008 + * RRDtool 1.3rc7 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