summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/mendexk/ChangeLog3
-rw-r--r--Build/source/texk/mendexk/main.c12
-rw-r--r--Build/source/texk/mendexk/styfile.c2
3 files changed, 9 insertions, 8 deletions
diff --git a/Build/source/texk/mendexk/ChangeLog b/Build/source/texk/mendexk/ChangeLog
index 9d8cb48640a..8a0f1d4834f 100644
--- a/Build/source/texk/mendexk/ChangeLog
+++ b/Build/source/texk/mendexk/ChangeLog
@@ -1,8 +1,7 @@
2016-11-12 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* mendex.h: Sync with W32TeX (W32 only).
- * styfile.c: Revert. Use fgets() instead of mfgets() in bfgets()
- to avoid access violation.
+ * main.c: Avoid access violation on Windows.
2016-09-28 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
diff --git a/Build/source/texk/mendexk/main.c b/Build/source/texk/mendexk/main.c
index 739b449d9f6..776888c8f5a 100644
--- a/Build/source/texk/mendexk/main.c
+++ b/Build/source/texk/mendexk/main.c
@@ -268,16 +268,18 @@ int main(int argc, char **argv)
}
if (!logfile && (idxcount-fsti > 0)) {
- logfile=xmalloc(strlen(idxfile[0]+6));
+ char llogfile[512];
+ for (i=0; i < 512; i++) llogfile[i] = '\0';
for (i=strlen(idxfile[0]);i>=0;i--) {
if (idxfile[0][i]=='.') {
- strncpy(logfile,idxfile[0],i);
- sprintf(&logfile[i],".ilg");
+ strncpy(llogfile,idxfile[0],i);
+ sprintf(&llogfile[i],".ilg");
break;
}
}
- if (i==-1) sprintf(logfile,"%s.ilg",idxfile[0]);
- }
+ if (i==-1) sprintf(llogfile,"%s.ilg",idxfile[0]);
+ logfile = xstrdup(llogfile);
+ }
if (logfile && kpse_out_name_ok(logfile))
efp=fopen(logfile,"wb");
if(efp == NULL) {
diff --git a/Build/source/texk/mendexk/styfile.c b/Build/source/texk/mendexk/styfile.c
index 04189664099..e35256c2e29 100644
--- a/Build/source/texk/mendexk/styfile.c
+++ b/Build/source/texk/mendexk/styfile.c
@@ -21,7 +21,7 @@ static char *
bfgets (char *buf, int size, FILE *fp)
{
char *p, *q;
- p = fgets (buf, size, fp);
+ p = mfgets (buf, size, fp);
for (q = buf; *q; q++) {
if(*q == '\r') {
*q++ = '\n';