texlive[50140] Build/source/texk: afm2tfm, ttfdump: forbid too long

commits+hironobu at tug.org commits+hironobu at tug.org
Tue Feb 26 11:19:50 CET 2019


Revision: 50140
          http://tug.org/svn/texlive?view=revision&revision=50140
Author:   hironobu
Date:     2019-02-26 11:19:50 +0100 (Tue, 26 Feb 2019)
Log Message:
-----------
afm2tfm, ttfdump: forbid too long file name

Modified Paths:
--------------
    trunk/Build/source/texk/dvipsk/ChangeLog
    trunk/Build/source/texk/dvipsk/afm2tfm.c
    trunk/Build/source/texk/ttfdump/ChangeLog
    trunk/Build/source/texk/ttfdump/src/ttfdump.c

Modified: trunk/Build/source/texk/dvipsk/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipsk/ChangeLog	2019-02-26 01:23:32 UTC (rev 50139)
+++ trunk/Build/source/texk/dvipsk/ChangeLog	2019-02-26 10:19:50 UTC (rev 50140)
@@ -1,3 +1,7 @@
+2019-02-26  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	* afm2tfm.c: Forbid too long file name.
+
 2019-02-11  Karl Berry  <karl at tug.org>
 
 	* dvips.texi,

Modified: trunk/Build/source/texk/dvipsk/afm2tfm.c
===================================================================
--- trunk/Build/source/texk/dvipsk/afm2tfm.c	2019-02-26 01:23:32 UTC (rev 50139)
+++ trunk/Build/source/texk/dvipsk/afm2tfm.c	2019-02-26 10:19:50 UTC (rev 50140)
@@ -210,8 +210,9 @@
 };
 
 FILE *afmin, *vplout, *tfmout;
-char inname[200], outname[200]; /* names of input and output files */
-char tmpstr[200]; /* a buffer for one string */
+#define MAXNAME 256
+char inname[MAXNAME], outname[MAXNAME]; /* names of input and output files */
+char tmpstr[MAXNAME]; /* a buffer for one string */
 #define INBUFSIZE 1024
 char buffer[INBUFSIZE+10]; /* input buffer (modified while parsing) */
 char obuffer[INBUFSIZE+10]; /* unmodified copy of input buffer */
@@ -1645,6 +1646,8 @@
    snprintf(titlebuf, sizeof(titlebuf), "%s %s", argv[0], argv[1]);
 #endif
 #endif
+   if(strlen(argv[1]) >= MAXNAME - 4)
+       error("! too long input file name");
    strcpy(inname, argv[1]);
 #ifdef KPATHSEA
    if (find_suffix(inname) == NULL)
@@ -1667,6 +1670,8 @@
 case 'V': makevpl++;
 case 'v': makevpl++;
          CHECKARG3
+         if(strlen(argv[3]) >= MAXNAME - 4)
+            error("! too long output VPL file name");
          strcpy(outname, argv[3]);
 #ifdef KPATHSEA
          if (find_suffix(outname) == NULL)

Modified: trunk/Build/source/texk/ttfdump/ChangeLog
===================================================================
--- trunk/Build/source/texk/ttfdump/ChangeLog	2019-02-26 01:23:32 UTC (rev 50139)
+++ trunk/Build/source/texk/ttfdump/ChangeLog	2019-02-26 10:19:50 UTC (rev 50140)
@@ -1,3 +1,7 @@
+2019-02-26  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	* src/ttfdump.c: Forbid too long file name.
+
 2017-06-24  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	* src/ttfdump.c: allow a suffix .TTC for ttc fonts.

Modified: trunk/Build/source/texk/ttfdump/src/ttfdump.c
===================================================================
--- trunk/Build/source/texk/ttfdump/src/ttfdump.c	2019-02-26 01:23:32 UTC (rev 50139)
+++ trunk/Build/source/texk/ttfdump/src/ttfdump.c	2019-02-26 10:19:50 UTC (rev 50140)
@@ -117,9 +117,17 @@
       collection = atoi(optarg);
       break;
     case 'i':
+      if(strlen(optarg) >= MAXLEN) {
+        fprintf(stderr, "Too long input file name\n");
+        exit(EXIT_FAILURE);
+      }
       strcpy(ttfname, optarg);
       break;
     case 'o':
+      if(strlen(optarg) >= MAXLEN) {
+        fprintf(stderr, "Too long output file name\n");
+        exit(EXIT_FAILURE);
+      }
       strcpy(dumpname, optarg);
       break;
     case 'h':
@@ -133,6 +141,10 @@
   /* processing ttf file if -i flag is not given */
   if (*ttfname == 0 && optind < argc)
   {
+    if(strlen(argv[optind]) >= MAXLEN) {
+      fprintf(stderr, "Too long input file name\n");
+      exit(EXIT_FAILURE);
+    }
     strcpy(ttfname, argv[optind]);
   }
 



More information about the tex-live-commits mailing list