From be3f8d06bdad1466d08e83ab7c3d29d2334d1742 Mon Sep 17 00:00:00 2001 From: Hironobu Yamashita Date: Tue, 26 Feb 2019 10:19:50 +0000 Subject: afm2tfm, ttfdump: forbid too long file name git-svn-id: svn://tug.org/texlive/trunk@50140 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipsk/afm2tfm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Build/source/texk/dvipsk/afm2tfm.c') diff --git a/Build/source/texk/dvipsk/afm2tfm.c b/Build/source/texk/dvipsk/afm2tfm.c index 13240a80b8f..c983dd555b1 100644 --- a/Build/source/texk/dvipsk/afm2tfm.c +++ b/Build/source/texk/dvipsk/afm2tfm.c @@ -210,8 +210,9 @@ struct pcc { }; 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 @@ openfiles(int argc, char **argv) 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 @@ openfiles(int argc, char **argv) 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) -- cgit v1.2.3