diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-11-12 14:19:54 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-11-12 14:19:54 +0000 |
commit | 6af6e0e251f621fd41787af90a4228b03f40222b (patch) | |
tree | 63e474840c94feb174a2766bf9c0a992967dd0f7 /Build | |
parent | e9c4ff8c8a5ff7dda8f5d0ab98bed2b270caefff (diff) |
mendexk: Avoid access violation (Thanks T. Tanaka)
git-svn-id: svn://tug.org/texlive/trunk@42491 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/mendexk/main.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Build/source/texk/mendexk/main.c b/Build/source/texk/mendexk/main.c index 776888c8f5a..91a45f9bc72 100644 --- a/Build/source/texk/mendexk/main.c +++ b/Build/source/texk/mendexk/main.c @@ -253,8 +253,6 @@ int main(int argc, char **argv) } } - 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 @@ int main(int argc, char **argv) } 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 @@ int main(int argc, char **argv) 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); |