--- src/conky.h.old 2005-11-30 01:08:25.000000000 -0500 +++ src/conky.h 2005-11-29 12:35:21.000000000 -0500 @@ -3,7 +3,7 @@ * * This program is licensed under BSD license, read COPYING * - * $Id: conky.h,v 1.26 2005/11/13 04:04:00 pkovacs Exp $ + * $Id: conky.h,v 1.29 2005/11/29 17:35:21 pkovacs Exp $ */ #ifndef _conky_h_ @@ -55,6 +55,9 @@ #define CRIT_ERR(s, varargs...) \ { fprintf(stderr, "Conky: " s "\n", ##varargs); exit(EXIT_FAILURE); } +#define MIN(a,b) (a>b ? b : a) +#define MAX(a,b) (a TEXT_BUFFER_SIZE-1 ) + fprintf(stderr,"buffer overrun detected\n"); + */ + tmpstring2[ MIN(pos + i2, TEXT_BUFFER_SIZE-1) ] = ' '; /* guard against overrun */ added++; } pos += i2; } else { if (tmpstring1[i] != 9) { - tmpstring2[pos] = tmpstring1[i]; + /* + if ( pos > TEXT_BUFFER_SIZE-1 ) + fprintf(stderr,"buffer overrun detected\n"); + */ + tmpstring2[ MIN(pos, TEXT_BUFFER_SIZE-1) ] = tmpstring1[i]; /* guard against overrun */ pos++; } }