texlive[46930] Build/source/utils/autosp: fix a potential bug in

commits+kakuto at tug.org commits+kakuto at tug.org
Mon Mar 12 10:16:43 CET 2018


Revision: 46930
          http://tug.org/svn/texlive?view=revision&revision=46930
Author:   kakuto
Date:     2018-03-12 10:16:42 +0100 (Mon, 12 Mar 2018)
Log Message:
-----------
fix a potential bug in autosp, Norbert.

Modified Paths:
--------------
    trunk/Build/source/utils/autosp/ChangeLog
    trunk/Build/source/utils/autosp/TLpatches/ChangeLog
    trunk/Build/source/utils/autosp/TLpatches/patch-01-binary-write
    trunk/Build/source/utils/autosp/autosp-src/autosp.c

Modified: trunk/Build/source/utils/autosp/ChangeLog
===================================================================
--- trunk/Build/source/utils/autosp/ChangeLog	2018-03-12 01:23:48 UTC (rev 46929)
+++ trunk/Build/source/utils/autosp/ChangeLog	2018-03-12 09:16:42 UTC (rev 46930)
@@ -1,3 +1,8 @@
+2018-03-12  Norbert Preining  <norbert at preining.info>
+
+	* autosp.c: Fix a potential bug in the usage of fprintf().
+	Avoid a compiler warning.
+
 2018-03-05  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	* autosp-src/tex2aspc.test: Make robust.

Modified: trunk/Build/source/utils/autosp/TLpatches/ChangeLog
===================================================================
--- trunk/Build/source/utils/autosp/TLpatches/ChangeLog	2018-03-12 01:23:48 UTC (rev 46929)
+++ trunk/Build/source/utils/autosp/TLpatches/ChangeLog	2018-03-12 09:16:42 UTC (rev 46930)
@@ -1,3 +1,7 @@
+2018-03-12  Norbert Preining  <norbert at preining.info>
+
+	* patch-01-binary-write: Add two changes in autosp.c.
+
 2018-02-23  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	Import autosp-2018-02-23.

Modified: trunk/Build/source/utils/autosp/TLpatches/patch-01-binary-write
===================================================================
--- trunk/Build/source/utils/autosp/TLpatches/patch-01-binary-write	2018-03-12 01:23:48 UTC (rev 46929)
+++ trunk/Build/source/utils/autosp/TLpatches/patch-01-binary-write	2018-03-12 09:16:42 UTC (rev 46930)
@@ -1,6 +1,6 @@
 diff -ur autosp-2018-02-23/autosp.c autosp-src/autosp.c
 --- autosp-2018-02-23/autosp.c	Fri Feb 23 23:55:07 2018
-+++ autosp-src/autosp.c	Sat Feb 24 08:07:57 2018
++++ autosp-src/autosp.c	Mon Mar 12 17:58:18 2018
 @@ -510,7 +510,7 @@
      update_global_skip (n);
        /* commas will be discarded by filter_output (i) */
@@ -28,8 +28,27 @@
  
    t = strpbrk (s+1, "{\\&|$"); /* collective coding?  */
    if (*t == '{')  /*  {...}  */
-@@ -2153,7 +2153,7 @@
+@@ -2007,7 +2007,7 @@
+          || prefix ("\\end%", *ln) 
+          || prefix ("\\end{document}", *ln) )
+   {
+-    fprintf (outfile, *ln);
++    fprintf (outfile, "%s", *ln);
+     exit(0);
    }
+ 
+@@ -2054,7 +2054,8 @@
+   while ( c != EOF )
+   {
+     ungetc (c, infile);
+-    fgets(line, LINE_LEN, infile); 
++    if (fgets(line, LINE_LEN, infile) == NULL)
++      error ("Unexpected EOF.");
+     lineno++;
+     process_line ();
+     c = getc (infile);
+@@ -2153,7 +2154,7 @@
+   }
    else
    {
 -    outfile = fopen (outfilename, "w");
@@ -37,7 +56,7 @@
      if (outfile == NULL)
      { printf ("Can't open %s\n", outfilename);
        exit (EXIT_FAILURE);
-@@ -2171,7 +2171,7 @@
+@@ -2171,7 +2172,7 @@
    *logfilename_n = '\0';
    append (logfilename, &logfilename_n, "alog", sizeof (logfilename));
    if (debug)  
@@ -48,7 +67,7 @@
        exit (EXIT_FAILURE);
 diff -ur autosp-2018-02-23/rebar.c autosp-src/rebar.c
 --- autosp-2018-02-23/rebar.c	Thu Jun 15 03:08:12 2017
-+++ autosp-src/rebar.c	Sat Feb 24 08:08:27 2018
++++ autosp-src/rebar.c	Sat Feb 24 08:08:28 2018
 @@ -262,7 +262,7 @@
        else
          append (outfilename, &outfilename_n, ".aspc", sizeof (outfilename));
@@ -60,7 +79,7 @@
        exit (EXIT_FAILURE);
 diff -ur autosp-2018-02-23/tex2aspc.c autosp-src/tex2aspc.c
 --- autosp-2018-02-23/tex2aspc.c	Sat Dec 16 00:04:13 2017
-+++ autosp-src/tex2aspc.c	Sat Feb 24 08:08:55 2018
++++ autosp-src/tex2aspc.c	Sat Feb 24 08:08:56 2018
 @@ -337,7 +337,7 @@
      append (outfilename, &outfilename_n, ".aspc", sizeof (outfilename));
    }

Modified: trunk/Build/source/utils/autosp/autosp-src/autosp.c
===================================================================
--- trunk/Build/source/utils/autosp/autosp-src/autosp.c	2018-03-12 01:23:48 UTC (rev 46929)
+++ trunk/Build/source/utils/autosp/autosp-src/autosp.c	2018-03-12 09:16:42 UTC (rev 46930)
@@ -2007,7 +2007,7 @@
          || prefix ("\\end%", *ln) 
          || prefix ("\\end{document}", *ln) )
   {
-    fprintf (outfile, *ln);
+    fprintf (outfile, "%s", *ln);
     exit(0);
   }
 
@@ -2054,7 +2054,8 @@
   while ( c != EOF )
   {
     ungetc (c, infile);
-    fgets(line, LINE_LEN, infile); 
+    if (fgets(line, LINE_LEN, infile) == NULL)
+      error ("Unexpected EOF.");
     lineno++;
     process_line ();
     c = getc (infile);



More information about the tex-live-commits mailing list