texinfo-commits
[Top][All Lists]
Advanced

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

[8394] parsetexi use strncmp instead of memcmp to avoid out-of-bounds re


From: gavinsmith0123
Subject: [8394] parsetexi use strncmp instead of memcmp to avoid out-of-bounds read
Date: Wed, 24 Oct 2018 11:45:59 -0400 (EDT)

Revision: 8394
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8394
Author:   gavin
Date:     2018-10-24 11:45:59 -0400 (Wed, 24 Oct 2018)
Log Message:
-----------
parsetexi use strncmp instead of memcmp to avoid out-of-bounds read

Modified Paths:
--------------
    trunk/tp/Texinfo/XS/parsetexi/macro.c

Modified: trunk/tp/Texinfo/XS/parsetexi/macro.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/macro.c       2018-10-24 15:09:25 UTC (rev 
8393)
+++ trunk/tp/Texinfo/XS/parsetexi/macro.c       2018-10-24 15:45:59 UTC (rev 
8394)
@@ -644,7 +644,7 @@
   /* Check if already defined. */
   for (i = 0; i < value_number; i++)
     {
-      if (!memcmp (value_list[i].name, name, len) && !value_list[i].name[len])
+      if (!strncmp (value_list[i].name, name, len) && !value_list[i].name[len])
         {
           v = &value_list[i];
           free (v->name); free (v->value);
@@ -665,6 +665,7 @@
   v->value = strdup (value);
 }
 
+/* Clear the value the name of which is LEN bytes at NAME */
 void
 clear_value (char *name, int len)
 {
@@ -671,7 +672,7 @@
   int i;
   for (i = 0; i < value_number; i++)
     {
-      if (!memcmp (value_list[i].name, name, len) && !value_list[i].name[len])
+      if (!strncmp (value_list[i].name, name, len) && !value_list[i].name[len])
         {
           value_list[i].name[0] = '\0';
           value_list[i].value[0] = '\0';
@@ -679,6 +680,7 @@
     }
 }
 
+/* Look for a value the name of which is LEN bytes at NAME */
 char *
 fetch_value (char *name, int len)
 {
@@ -685,7 +687,7 @@
   int i;
   for (i = 0; i < value_number; i++)
     {
-      if (!memcmp (value_list[i].name, name, len) && !value_list[i].name[len])
+      if (!strncmp (value_list[i].name, name, len) && !value_list[i].name[len])
         return value_list[i].value;
     }
 




reply via email to

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