[gnome-builder/gnome-builder-3-18] editorconfig: add precondition check for name length



commit 70d9edf1e773a765d91213c5703a445910269642
Author: Christian Hergert <christian hergert me>
Date:   Sat Oct 3 16:58:38 2015 -0700

    editorconfig: add precondition check for name length
    
    If only everyone used glib.

 contrib/libeditorconfig/editorconfig.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/contrib/libeditorconfig/editorconfig.c b/contrib/libeditorconfig/editorconfig.c
index 778b23c..dcf2d39 100644
--- a/contrib/libeditorconfig/editorconfig.c
+++ b/contrib/libeditorconfig/editorconfig.c
@@ -139,6 +139,10 @@ static int array_editorconfig_name_value_add(
     /* always use name_lwr but not name, since property names are case
      * insensitive */
     char        name_lwr[MAX_PROPERTY_NAME];
+
+    if (strlen (name) > (MAX_PROPERTY_NAME - 1))
+      return -1;
+
     /* For the first time we came here, aenv->name_values is NULL */
     if (aenv->name_values == NULL) {
         aenv->name_values = (editorconfig_name_value*)malloc(


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