texlive[42491] Build/source/texk/mendexk/main.c: mendexk: Avoid

commits+kakuto at tug.org commits+kakuto at tug.org
Sat Nov 12 15:19:54 CET 2016


Revision: 42491
          http://tug.org/svn/texlive?view=revision&revision=42491
Author:   kakuto
Date:     2016-11-12 15:19:54 +0100 (Sat, 12 Nov 2016)
Log Message:
-----------
mendexk: Avoid access violation (Thanks T. Tanaka)

Modified Paths:
--------------
    trunk/Build/source/texk/mendexk/main.c

Modified: trunk/Build/source/texk/mendexk/main.c
===================================================================
--- trunk/Build/source/texk/mendexk/main.c	2016-11-12 14:01:21 UTC (rev 42490)
+++ trunk/Build/source/texk/mendexk/main.c	2016-11-12 14:19:54 UTC (rev 42491)
@@ -253,8 +253,6 @@
 		}
 	}
 
-	if (styfile!=NULL) styread(styfile);
-
 	if (!indfile &&(idxcount-fsti>0)) {
 		indfile=xmalloc(strlen(idxfile[0]+6));
 		for (i=strlen(idxfile[0]);i>=0;i--) {
@@ -268,18 +266,16 @@
 	}
 
 	if (!logfile && (idxcount-fsti > 0)) {
-		char llogfile[512];
-		for (i=0; i < 512; i++) llogfile[i] = '\0';
+		logfile=xmalloc(strlen(idxfile[0]+6));
 		for (i=strlen(idxfile[0]);i>=0;i--) {
 			if (idxfile[0][i]=='.') {
-				strncpy(llogfile,idxfile[0],i);
-				sprintf(&llogfile[i],".ilg");
+				strncpy(logfile,idxfile[0],i);
+				sprintf(&logfile[i],".ilg");
 				break;
 			}
 		}
-		if (i==-1) sprintf(llogfile,"%s.ilg",idxfile[0]);
-        	logfile = xstrdup(llogfile);
-	}
+		if (i==-1) sprintf(logfile,"%s.ilg",idxfile[0]);
+		}
 	if (logfile && kpse_out_name_ok(logfile))
 		efp=fopen(logfile,"wb");
 	if(efp == NULL) {
@@ -287,6 +283,8 @@
 		logfile=xstrdup("stderr");
 	}
 
+	if (styfile!=NULL) styread(styfile);
+
 	if (strcmp(argv[0],"makeindex")==0) {
 		verb_printf(efp,"This is Not `MAKEINDEX\', But `MENDEX\' %s (%s) (%s).\n",
 			    VERSION, get_enc_string(), TL_VERSION);



More information about the tex-live-commits mailing list