* elf64-ppc.c (ppc_add_stub): Replace strcpy/strncpy with memcpy.
[deliverable/binutils-gdb.git] / bfd / elflink.c
index e74fae9643574b3aedef191d8d73f12c0512ed6b..25a519308d43a31c728f5849d32620239af4008c 100644 (file)
@@ -278,11 +278,13 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
        }
       else
        {
-         alc = bfd_malloc ((bfd_size_type) (p - name + 1));
+         size_t len = p - name + 1;
+
+         alc = bfd_malloc ((bfd_size_type) len);
          if (alc == NULL)
            return false;
-         strncpy (alc, name, (size_t) (p - name));
-         alc[p - name] = '\0';
+         memcpy (alc, name, len - 1);
+         alc[len - 1] = '\0';
          name = alc;
          copy = true;
        }
This page took 0.02951 seconds and 4 git commands to generate.