summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipsk/emspecial.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/dvipsk/emspecial.c')
-rw-r--r--Build/source/texk/dvipsk/emspecial.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Build/source/texk/dvipsk/emspecial.c b/Build/source/texk/dvipsk/emspecial.c
index 3210a8a2639..e3d66431c08 100644
--- a/Build/source/texk/dvipsk/emspecial.c
+++ b/Build/source/texk/dvipsk/emspecial.c
@@ -145,6 +145,22 @@ char emunit[30];
char emstr[500];
char *emp;
+/* Initialize emstr[500] because emstr in the code below may not
+ be a right string, leading to wrong strlen(emstr):
+
+ if (strlen(emstr) - 2 >= sizeof(emstr)) {
+ fprintf(stderr, "em:graph: special too long, truncating\n");
+ break;
+ }
+ emstr[i++] = *emp;
+ }
+*/
+ {
+ int k;
+ for (k = 0; k < 500; k++)
+ emstr[k] = '\0';
+ }
+
hvpos();
for (emp = p+3; *emp && isspace((unsigned char)*emp); emp++); /* skip blanks */
if (strncmp(emp, "linewidth", 9) == 0) {