public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/95530] [11 regression] ICE in gfortran.dg/equiv_11.f90 after r11-594
Date: Thu, 04 Jun 2020 21:06:45 +0000	[thread overview]
Message-ID: <bug-95530-4-420EqdWZH7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95530-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95530

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org

--- Comment #6 from anlauf at gcc dot gnu.org ---
In addition to the patch in comment#5, we can "harden" the strcpy:

diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 3775a8bea74..1acc336eacf 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -1314,7 +1314,11 @@ finish_equivalences (gfc_namespace *ns)
              c->where = ns->proc_name->declared_at;
            else if (ns->is_block_data)
              c->where = ns->sym_root->n.sym->declared_at;
-           strcpy (c->name, z->module);
+
+           size_t len = strlen (z->module);
+           gcc_assert (len < sizeof (c->name));
+           memcpy (c->name, z->module, len);
+           c->name[len] = '\0';
          }
        else
          c = NULL;

  parent reply	other threads:[~2020-06-04 21:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04 11:41 [Bug fortran/95530] New: " seurer at linux dot vnet.ibm.com
2020-06-04 11:55 ` [Bug fortran/95530] " rguenth at gcc dot gnu.org
2020-06-04 17:21 ` anlauf at gcc dot gnu.org
2020-06-04 19:05 ` seurer at linux dot vnet.ibm.com
2020-06-04 20:13 ` seurer at linux dot vnet.ibm.com
2020-06-04 20:17 ` seurer at linux dot vnet.ibm.com
2020-06-04 20:24 ` anlauf at gcc dot gnu.org
2020-06-04 21:06 ` anlauf at gcc dot gnu.org [this message]
2020-06-04 21:15 ` seurer at linux dot vnet.ibm.com
2020-06-04 21:18 ` seurer at linux dot vnet.ibm.com
2020-06-04 21:32 ` anlauf at gcc dot gnu.org
2020-06-04 23:31 ` seurer at linux dot vnet.ibm.com
2020-06-05 16:47 ` anlauf at gcc dot gnu.org
2020-06-05 18:30 ` cvs-commit at gcc dot gnu.org
2020-06-05 19:32 ` cvs-commit at gcc dot gnu.org
2020-06-05 20:35 ` cvs-commit at gcc dot gnu.org
2020-06-05 20:37 ` anlauf at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-95530-4-420EqdWZH7@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).