$OpenBSD: patch-texk_mendexk_fwrite_c,v 1.1 2014/01/11 18:46:52 edd Exp $

http://tug.org/pipermail/tldistro/2013q3/000218.html

--- texk/mendexk/fwrite.c.origy	Fri Oct  4 11:30:16 2013
+++ texk/mendexk/fwrite.c	Fri Oct  4 11:31:35 2013
@@ -15,7 +15,7 @@ static int range_check(struct index ind, int count, ch
 static void linecheck(char *lbuff, char *tmpbuff);
 static void crcheck(char *lbuff, FILE *fp);
 
-#define TAIL(x) (x+strlen(x))
+#define TAIL(x) ((x)+strlen(x))
 
 /* if we don't have vsnprintf() */
 /* #define vsnprintf(buff,len,format,argptr) vsprintf(buff,format,argptr) */
@@ -385,7 +385,7 @@ static int range_check(struct index ind, int count, ch
 					}
 					if (strlen(ind.p[j].enc)>0) {
 						sprintf(tmpbuff,"%s%s%s",encap_prefix,ind.p[j].enc,encap_infix);
-						sprintf(tmpbuff,"%s%s%s",ind.p[j].page,encap_suffix,delim_n);
+						sprintf(TAIL(tmpbuff),"%s%s%s",ind.p[j].page,encap_suffix,delim_n);
 						linecheck(lbuff,tmpbuff);
 					}
 				}
