summaryrefslogtreecommitdiff
path: root/Build/source/texk/mendexk
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2021-06-13 11:12:25 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2021-06-13 11:12:25 +0000
commit1ea6ce62b6cea8d2b60116445ac2393790507d7f (patch)
treed98759ed71305dae66cb121d56879a1547780119 /Build/source/texk/mendexk
parent44958b1376805463a7f24c6b8a369b55ebc129b7 (diff)
mendex: bug fixes, including security fix (2021-06-13)
git-svn-id: svn://tug.org/texlive/trunk@59571 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/mendexk')
-rw-r--r--Build/source/texk/mendexk/ChangeLog10
-rw-r--r--Build/source/texk/mendexk/fwrite.c19
-rw-r--r--Build/source/texk/mendexk/pageread.c2
-rw-r--r--Build/source/texk/mendexk/styfile.c2
-rw-r--r--Build/source/texk/mendexk/version.h2
5 files changed, 27 insertions, 8 deletions
diff --git a/Build/source/texk/mendexk/ChangeLog b/Build/source/texk/mendexk/ChangeLog
index 3d0e4fb5f4a..dda22c2955c 100644
--- a/Build/source/texk/mendexk/ChangeLog
+++ b/Build/source/texk/mendexk/ChangeLog
@@ -1,3 +1,13 @@
+2021-06-13 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * fwrite.c: Avoid segmentation fault for unwritable fopen.
+ Recognize symhead_{positive,negative} for non-default
+ character_order.
+ * pageread.c, styfile.c: Exit code 255 for non-existent
+ style/log file.
+ * version.h: Date [13-Jun-2021], but still Version 3.5 (bugfix
+ only).
+
2021-06-06 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
* configure.ac, version.h:
diff --git a/Build/source/texk/mendexk/fwrite.c b/Build/source/texk/mendexk/fwrite.c
index 48162ef75e6..078e334c845 100644
--- a/Build/source/texk/mendexk/fwrite.c
+++ b/Build/source/texk/mendexk/fwrite.c
@@ -121,11 +121,12 @@ void indwrite(char *filename, struct index *ind, int pagenum)
{
int i,j,hpoint=0;
char datama[2048],lbuff[BUFFERLEN];
- FILE *fp;
+ FILE *fp=NULL;
int conv_euc_to_euc;
- if (filename && kpse_out_name_ok(filename)) fp=fopen(filename,"wb");
- else {
+ if (filename && kpse_out_name_ok(filename))
+ fp=fopen(filename,"wb");
+ if (fp == NULL) {
fp=stdout;
#ifdef WIN32
setmode(fileno(fp), _O_BINARY);
@@ -218,7 +219,15 @@ void indwrite(char *filename, struct index *ind, int pagenum)
if ((alphabet(ind[i-1].dic[0][0]))||(japanese(ind[i-1].dic[0]))){
fputs(group_skip,fp);
if (lethead_flag && symbol_flag) {
- fprintf(fp,"%s%s%s",lethead_prefix,symbol,lethead_suffix);
+ if (strlen(symbol)) {
+ fprintf(fp,"%s%s%s",lethead_prefix,symbol,lethead_suffix);
+ }
+ else if (lethead_flag>0) {
+ fprintf(fp,"%s%s%s",lethead_prefix,symhead_positive,lethead_suffix);
+ }
+ else if (lethead_flag<0) {
+ fprintf(fp,"%s%s%s",lethead_prefix,symhead_negative,lethead_suffix);
+ }
}
}
}
@@ -309,7 +318,7 @@ void indwrite(char *filename, struct index *ind, int pagenum)
}
fputs(postamble,fp);
- if (filename) fclose(fp);
+ if (fp!=stdout) fclose(fp);
}
/* write page block */
diff --git a/Build/source/texk/mendexk/pageread.c b/Build/source/texk/mendexk/pageread.c
index b77fb2931d9..ac72af48b86 100644
--- a/Build/source/texk/mendexk/pageread.c
+++ b/Build/source/texk/mendexk/pageread.c
@@ -39,7 +39,7 @@ int lastpage(const char *filename)
fp=NULL;
if (fp==NULL) {
fprintf(stderr,"No log file, %s.\n",logfile);
- exit(0);
+ exit(255);
}
while (1) {
diff --git a/Build/source/texk/mendexk/styfile.c b/Build/source/texk/mendexk/styfile.c
index 1a92516e190..db5651cf0cb 100644
--- a/Build/source/texk/mendexk/styfile.c
+++ b/Build/source/texk/mendexk/styfile.c
@@ -46,7 +46,7 @@ void styread(const char *filename)
fp=NULL;
if (fp==NULL) {
fprintf(stderr,"%s does not exist.\n",filename);
- exit(0);
+ exit(255);
}
verb_printf(efp,"Scanning style file %s.",filename);
diff --git a/Build/source/texk/mendexk/version.h b/Build/source/texk/mendexk/version.h
index f55a056b0c3..565459f3239 100644
--- a/Build/source/texk/mendexk/version.h
+++ b/Build/source/texk/mendexk/version.h
@@ -1,2 +1,2 @@
-#define VERSION "version " PACKAGE_VERSION " [6-Jun-2021]"
+#define VERSION "version " PACKAGE_VERSION " [13-Jun-2021]"
#define BUG_ADDRESS "issue@texjp.org"