texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[7448] parse_top_node_line


From: gavinsmith0123
Subject: [7448] parse_top_node_line
Date: Wed, 12 Oct 2016 06:38:14 +0000 (UTC)

Revision: 7448
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7448
Author:   gavin
Date:     2016-10-12 06:38:13 +0000 (Wed, 12 Oct 2016)
Log Message:
-----------
parse_top_node_line

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/info-utils.c
    trunk/info/nodes.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2016-10-10 20:58:07 UTC (rev 7447)
+++ trunk/ChangeLog     2016-10-12 06:38:13 UTC (rev 7448)
@@ -1,3 +1,13 @@
+2016-10-12  Gavin Smith  <address@hidden>
+
+       * info/info-utils.c (parse_top_node_line):  Check if the
+       buffer ends before the end of the first line.  Out-of-bounds
+       read reported by Hanno B\xF6ck.  Some comments changed.
+       * info/nodes.c (node_set_body_start): Don't try to advance the
+       'body_start' past the end of the first line of the node: it is 
+       not necessary, and the current code breaks if the buffer ends 
+       during the first line.
+
 2016-10-09  Gavin Smith  <address@hidden>
 
        * info/man.c (xrefs_of_manpage): Allow SGR sequence in manpage

Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c     2016-10-10 20:58:07 UTC (rev 7447)
+++ trunk/info/info-utils.c     2016-10-12 06:38:13 UTC (rev 7448)
@@ -1150,13 +1150,15 @@
         }
       ptr += skip_whitespace (ptr);
 
+      /* Get length of a bracketed filename component. */
       if (*ptr != '(')
         value_length = 0;
       else
         value_length = read_bracketed_filename (ptr, 0);
 
-      /* Separate at commas or newlines, so it will work for
-         filenames including full stops. */
+      /* Get length of node name, or filename if following "File:".  Note 
+         that .  is not included in the second argument here in order to 
+         support this character in file names. */
       value_length += read_quoted_string (ptr + value_length,
                                           "\n\r\t,", 1, &nodename);
       if (store_in)
@@ -1169,11 +1171,8 @@
       free (nodename);
       ptr += value_length;
 
-      if (*ptr == '\n')
-        {
-          ptr++;
-          break;
-        }
+      if (*ptr == '\n' || !*ptr)
+        break;
 
       ptr += 1; /* Point after field terminator */
     }

Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c  2016-10-10 20:58:07 UTC (rev 7447)
+++ trunk/info/nodes.c  2016-10-12 06:38:13 UTC (rev 7448)
@@ -1061,8 +1061,6 @@
   int n = skip_node_separator (node->contents);
   node->body_start = strcspn(node->contents + n, "\n");
   node->body_start += n;
-  if (node->contents[++node->body_start] == '\n')
-    ++node->body_start;
 }
 
 /* Return a pointer to a NODE structure for the Info node NODENAME in




reply via email to

[Prev in Thread] Current Thread [Next in Thread]