diff -Nurd -x'*~' gift-0.11.8.1.orig/src/plugin.c gift-0.11.8.1/src/plugin.c --- gift-0.11.8.1.orig/src/plugin.c 2004-11-11 21:52:16.000000000 -0500 +++ gift-0.11.8.1/src/plugin.c 2012-02-10 13:27:44.000000000 -0500 @@ -122,17 +122,18 @@ /* * This is just terrible. Please make me fix this. */ -#define APPENDMSG msg + msgwr, sizeof (msg) - msgwr - 1 +#define APPENDMSGptr msg + msgwr +#define APPENDMSGlen sizeof (msg) - msgwr - 1 #define LOGMSG(fmt,pfx1,pfx2) \ char msg[4096]; \ size_t msgwr = 0; \ va_list args; \ if (pfx1) \ - msgwr += snprintf (APPENDMSG, "%s: ", STRING_NOTNULL(pfx1)); \ + msgwr += snprintf (APPENDMSGptr, APPENDMSGlen, "%s: ", STRING_NOTNULL(pfx1)); \ if (pfx2) \ - msgwr += snprintf (APPENDMSG, "[%s]: ", STRING_NOTNULL(pfx2)); \ + msgwr += snprintf (APPENDMSGptr, APPENDMSGlen, "[%s]: ", STRING_NOTNULL(pfx2)); \ va_start (args, fmt); \ - vsnprintf (APPENDMSG, fmt, args); \ + vsnprintf (APPENDMSGptr, APPENDMSGlen, fmt, args); \ va_end (args); static int wrapper_dbg (Protocol *p, char *fmt, ...)