summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x/spc_pdfm.c
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2019-03-29 22:13:05 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2019-03-29 22:13:05 +0000
commitd22ffd7a19d10bea6d6a6ee371c17cd8387a202f (patch)
tree36fd5d7dde1cc47957ca0d3faf5e0aea4868d3af /Build/source/texk/dvipdfm-x/spc_pdfm.c
parent7c46aa4892ef00d7ea3c61c546e785186c1d3565 (diff)
fix security problem reported by Andy Nguyen
git-svn-id: svn://tug.org/texlive/trunk@50645 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfm-x/spc_pdfm.c')
-rw-r--r--Build/source/texk/dvipdfm-x/spc_pdfm.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Build/source/texk/dvipdfm-x/spc_pdfm.c b/Build/source/texk/dvipdfm-x/spc_pdfm.c
index 71386613a50..a5e8d10b928 100644
--- a/Build/source/texk/dvipdfm-x/spc_pdfm.c
+++ b/Build/source/texk/dvipdfm-x/spc_pdfm.c
@@ -1764,15 +1764,17 @@ spc_handler_pdfm_bgcolor (struct spc_env *spe, struct spc_arg *args)
return error;
}
+#define THEBUFFLENGTH 1024
static int
spc_handler_pdfm_mapline (struct spc_env *spe, struct spc_arg *ap)
{
fontmap_rec *mrec;
char *map_name, opchr;
int error = 0;
- static char buffer[1024];
+ static char buffer[THEBUFFLENGTH];
const char *p;
char *q;
+ int count;
skip_white(&ap->curptr, ap->endptr);
if (ap->curptr >= ap->endptr) {
@@ -1800,8 +1802,13 @@ spc_handler_pdfm_mapline (struct spc_env *spe, struct spc_arg *ap)
default:
p = ap->curptr;
q = buffer;
- while (p < ap->endptr)
+ count = 0;
+ while (p < ap->endptr && count < THEBUFFLENGTH - 1) {
*q++ = *p++;
+ count++;
+ }
+ if (count == THEBUFFLENGTH - 1)
+ spc_warn(spe, "Too long a fontmap line.");
*q = '\0';
mrec = NEW(1, fontmap_rec);
pdf_init_fontmap_record(mrec);