X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_info.c;h=13d30a6cd37fed0a5d70b3376882adaf7c68b1b5;hb=daf8e7ff715a59e1f9827080d1b785ffb3c5a4b1;hp=cf90e0e2b8cbe1115f0589f0029b95cb65c0b9fc;hpb=3c268443bb768669f3bd095b9e95a9a5ab4c5ef2;p=rrdtool.git diff --git a/src/rrd_info.c b/src/rrd_info.c index cf90e0e..13d30a6 100644 --- a/src/rrd_info.c +++ b/src/rrd_info.c @@ -1,5 +1,5 @@ /***************************************************************************** - * RRDtool 1.3rc6 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