makes imginfo work even when there are long image paths.
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1385
a5681a0c-68f1-0310-ab6d-
d61299d08faa
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