Do not overflow string buffer (PR objc/85476).
authorMartin Liska <mliska@suse.cz>
Fri, 20 Apr 2018 12:55:36 +0000 (14:55 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 20 Apr 2018 12:55:36 +0000 (12:55 +0000)
2018-04-20  Martin Liska  <mliska@suse.cz>

PR objc/85476
* objc-act.c (finish_class): Do not overflow string buffer.

From-SVN: r259521

gcc/objc/ChangeLog
gcc/objc/objc-act.c

index d95f3e433aa104a978778d97914c89cb0d6f6db3..63693714d04ad19510f5c68f0c65005fa2102a38 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-20  Martin Liska  <mliska@suse.cz>
+
+       PR objc/85476
+       * objc-act.c (finish_class): Do not overflow string buffer.
+
 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
 
        Update copyright years.
index b87f7cc075ed98323bf0c76157f8c396df4de034..d08693051eaa0afc05a5b229ba930ef0fa601289 100644 (file)
@@ -8003,7 +8003,7 @@ finish_class (tree klass)
                    char *setter_name = (char *) alloca (length);
                    tree ret_type, selector, arg_type, arg_name;
 
-                   strcpy (setter_name, full_setter_name);
+                   memcpy (setter_name, full_setter_name, length - 1);
                    setter_name[length - 1] = '\0';
                    ret_type = build_tree_list (NULL_TREE, void_type_node);
                    arg_type = build_tree_list (NULL_TREE, TREE_TYPE (x));