summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-12-14 01:24:14 +0000
committerKarl Berry <karl@freefriends.org>2009-12-14 01:24:14 +0000
commit5cda2a5283776c8380e14ca88088f543dd072144 (patch)
tree6fbebf6db7454b43b397e9d28ab96d49fab5f382
parentfe5f2880bf0497ad075041ccaa6b7a1f7e803cdd (diff)
increase array sizes of emunity and emstr, try to check for overflow
git-svn-id: svn://tug.org/texlive/trunk@16397 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/dvipsk/ChangeLog6
-rw-r--r--Build/source/texk/dvipsk/emspecial.c11
2 files changed, 14 insertions, 3 deletions
diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog
index 1420b758993..e2a23921888 100644
--- a/Build/source/texk/dvipsk/ChangeLog
+++ b/Build/source/texk/dvipsk/ChangeLog
@@ -1,5 +1,11 @@
2009-12-14 Karl Berry <karl@tug.org>
+ * emspecial.c (emspecial):
+ Increase size of emunit to 30.
+ Increase size of emstr to 250.
+ Attempt to check that we don't overflow emstr.
+ Report from Alexander, tlsec 02 Dec 2009 00:28:33.
+
* pc: remove obsolete subdir.
* Makefile.am (EXTRA_DIST): rm.
diff --git a/Build/source/texk/dvipsk/emspecial.c b/Build/source/texk/dvipsk/emspecial.c
index 6edfcbf0ed4..8b455d4c94d 100644
--- a/Build/source/texk/dvipsk/emspecial.c
+++ b/Build/source/texk/dvipsk/emspecial.c
@@ -140,8 +140,8 @@ emspecial(char *p)
float emwidth, emheight;
shalfword empoint1, empoint2;
struct empt *empoint;
-char emunit[3];
-char emstr[80];
+char emunit[30];
+char emstr[250];
char *emp;
#ifndef KPATHSEA
void emgraph();
@@ -277,8 +277,13 @@ void emgraph();
else if (strncmp(emp, "graph", 5) == 0) {
int i;
for (emp = emp+5; *emp && isspace(*emp); emp++); /* skip blanks */
- for (i=0; *emp && !isspace(*emp) && !(*emp==',') ; emp++)
+ for (i=0; *emp && !isspace(*emp) && !(*emp==',') ; emp++) {
+ if (strlen(emstr) - 2 >= sizeof(emstr)) {
+ fprintf(stderr, "em:graph: special too long, truncating\n") ;
+ break;
+ }
emstr[i++] = *emp; /* copy filename */
+ }
emstr[i] = '\0';
/* now get optional width and height */
emwidth = emheight = -1.0; /* no dimension is <= 0 */