texlive[42692] Build/source/texk/dvipsk: dvipsk: Fix a bug leading to

commits+kakuto at tug.org commits+kakuto at tug.org
Tue Dec 13 05:18:45 CET 2016


Revision: 42692
          http://tug.org/svn/texlive?view=revision&revision=42692
Author:   kakuto
Date:     2016-12-13 05:18:45 +0100 (Tue, 13 Dec 2016)
Log Message:
-----------
dvipsk: Fix a bug leading to wrong strlen (emstr). Thanks Norbert Klingen.

Modified Paths:
--------------
    trunk/Build/source/texk/dvipsk/ChangeLog
    trunk/Build/source/texk/dvipsk/emspecial.c

Modified: trunk/Build/source/texk/dvipsk/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipsk/ChangeLog	2016-12-13 01:05:26 UTC (rev 42691)
+++ trunk/Build/source/texk/dvipsk/ChangeLog	2016-12-13 04:18:45 UTC (rev 42692)
@@ -1,3 +1,9 @@
+2016-12-13  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
+
+	* emspecial.c: Initialize emstr[500] in emspecial(), to fix wrong
+	strlen (emstr). Reported by Norbert Klingen:
+	http://tug.org/pipermail/tex-live/2016-December/039483.html.
+
 2016-11-08  Karl Berry  <karl at freefriends.org>
 
 	* dvips.texi,

Modified: trunk/Build/source/texk/dvipsk/emspecial.c
===================================================================
--- trunk/Build/source/texk/dvipsk/emspecial.c	2016-12-13 01:05:26 UTC (rev 42691)
+++ trunk/Build/source/texk/dvipsk/emspecial.c	2016-12-13 04:18:45 UTC (rev 42692)
@@ -145,6 +145,22 @@
 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) {



More information about the tex-live-commits mailing list